mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
regularize emptiness checks in fini_module(2) and vfs_dedupe_file_range()
With few exceptions emptiness checks are done as fd_file(...) in boolean context (usually something like if (!fd_file(f))...); those will be taken care of later. However, there's a couple of places where we do those checks as 'store fd_file(...) into a variable, then check if this variable is NULL' and those are harder to spot. Get rid of those now. use fd_empty() instead of extracting file and then checking it for NULL. Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -537,9 +537,8 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
|
||||
|
||||
for (i = 0, info = same->info; i < count; i++, info++) {
|
||||
struct fd dst_fd = fdget(info->dest_fd);
|
||||
struct file *dst_file = fd_file(dst_fd);
|
||||
|
||||
if (!dst_file) {
|
||||
if (fd_empty(dst_fd)) {
|
||||
info->status = -EBADF;
|
||||
goto next_loop;
|
||||
}
|
||||
@@ -549,7 +548,7 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
|
||||
goto next_fdput;
|
||||
}
|
||||
|
||||
deduped = vfs_dedupe_file_range_one(file, off, dst_file,
|
||||
deduped = vfs_dedupe_file_range_one(file, off, fd_file(dst_fd),
|
||||
info->dest_offset, len,
|
||||
REMAP_FILE_CAN_SHORTEN);
|
||||
if (deduped == -EBADE)
|
||||
|
||||
Reference in New Issue
Block a user