]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
vfs: skip zero-length dedupe requests
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 29 Oct 2018 23:41:01 +0000 (10:41 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 29 Oct 2018 23:41:01 +0000 (10:41 +1100)
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>
fs/read_write.c

index 0f0a6efdd502c6e2682a06cb83b517636a474142..f5395d8da741eca048d1367c54232bdc72983aea 100644 (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: