Skip to content

Commit 6b1a5ae

Browse files
author
Al Viro
committed
convert vfs_dedupe_file_range().
fdput() is followed by checking fatal_signal_pending() (and aborting the loop in such case). fdput() is transposable with that check. Yes, it'll probably end up with slightly fatter code (call after the check has returned false + call on the almost never taken out-of-line path instead of one call before the check), but it's not worth bothering with explicit extra scope there (or dragging the check into the loop condition, for that matter). Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 9bd8127 commit 6b1a5ae

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/remap_range.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
536536
}
537537

538538
for (i = 0, info = same->info; i < count; i++, info++) {
539-
struct fd dst_fd = fdget(info->dest_fd);
539+
CLASS(fd, dst_fd)(info->dest_fd);
540540

541541
if (fd_empty(dst_fd)) {
542542
info->status = -EBADF;
@@ -545,7 +545,7 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
545545

546546
if (info->reserved) {
547547
info->status = -EINVAL;
548-
goto next_fdput;
548+
goto next_loop;
549549
}
550550

551551
deduped = vfs_dedupe_file_range_one(file, off, fd_file(dst_fd),
@@ -558,8 +558,6 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
558558
else
559559
info->bytes_deduped = len;
560560

561-
next_fdput:
562-
fdput(dst_fd);
563561
next_loop:
564562
if (fatal_signal_pending(current))
565563
break;

0 commit comments

Comments
 (0)