diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-10-30 10:41:01 +1100 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2018-10-30 10:41:01 +1100 |
commit | 9aae20500d9cd3e7d55d0536d359bdd1c869db89 (patch) | |
tree | 030cee6e5d4a6d1a3f4efae5797e82789b1af136 /fs/read_write.c | |
parent | 07d19dc9fbe9128378b9e226abe886fd8fd473df (diff) | |
download | lwn-9aae20500d9cd3e7d55d0536d359bdd1c869db89.tar.gz lwn-9aae20500d9cd3e7d55d0536d359bdd1c869db89.zip |
vfs: skip zero-length dedupe requests
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@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index 0f0a6efdd502..f5395d8da741 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -2009,6 +2009,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: |