projects/linux·commit 4a57a840

vf/remap: return the amount of bytes actually deduplicated

4a57a840 · Ansgar Lößer <[email protected]> · 2022-07-13 20:51:44 +02:00

When using the FIDEDUPRANGE ioctl, in case of success the requested size
is returned. In some cases this might not be the actual amount of bytes
deduplicated.

This change modifies vfs_dedupe_file_range() to report the actual amount
of bytes deduplicated, instead of the requested amount.

Link: https://lore.kernel.org/linux-fsdevel/[email protected]/
Reported-by: Ansgar Lößer <[email protected]>
Reported-by: Max Schlecht <[email protected]>
Reported-by: Björn Scheuermann <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: Darrick J Wong <[email protected]>
Signed-off-by: Ansgar Lößer <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
4a57a8400075bc5287c5c877702c68aeae2a033d
Parents
d0b97f38

Changes

1 files changed · +1 −1

FileStatusAddDelContent
fs/remap_range.cmodified+1−1View file

fs/remap_range.c

View file
diff --git a/fs/remap_range.c b/fs/remap_range.c
index 881a306..5e0d97e 100644
--- a/fs/remap_range.c
+++ b/fs/remap_range.c
@@ -547,7 +547,7 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
else if (deduped < 0)
info->status = deduped;
else
- info->bytes_deduped = len;
+ info->bytes_deduped = deduped;
next_fdput:
fdput(dst_fd);