[Ocfs2-devel] [PATCH 06/25] vfs: skip zero-length dedupe requests
Darrick J. Wong
darrick.wong at oracle.com
Fri Oct 12 17:06:24 PDT 2018
From: Darrick J. Wong <darrick.wong at oracle.com>
Don't bother calling the filesystem for a zero-length dedupe request;
we can return zero and exit.
Signed-off-by: Darrick J. Wong <darrick.wong at oracle.com>
Reviewed-by: Christoph Hellwig <hch at lst.de>
Reviewed-by: Amir Goldstein <amir73il at gmail.com>
---
fs/read_write.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/read_write.c b/fs/read_write.c
index 067ff5698e0b..2d84d18dc095 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1991,6 +1991,11 @@ int vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
if (!dst_file->f_op->dedupe_file_range)
goto out_drop_write;
+ if (len == 0) {
+ ret = 0;
+ goto out_drop_write;
+ }
+
ret = dst_file->f_op->dedupe_file_range(src_file, src_pos,
dst_file, dst_pos, len);
out_drop_write:
More information about the Ocfs2-devel
mailing list