1
0
Fork 0

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>
hifive-unleashed-5.1
Darrick J. Wong 2018-10-30 10:41:01 +11:00 committed by Dave Chinner
parent 07d19dc9fb
commit 9aae20500d
1 changed files with 5 additions and 0 deletions

View File

@ -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: