]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
vfs: plumb remap flags through the vfs dedupe functions
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 29 Oct 2018 23:42:03 +0000 (10:42 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 29 Oct 2018 23:42:03 +0000 (10:42 +1100)
Plumb a remap_flags argument through the vfs_dedupe_file_range_one
functions so that dedupe can take advantage of it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/overlayfs/file.c
fs/read_write.c
include/linux/fs.h

index 0393815c897175e3fd5a6b14e7b8e72356449f3f..84dd957efa24a17e8a66416117790896fd1d04ff 100644 (file)
@@ -467,7 +467,8 @@ static loff_t ovl_copyfile(struct file *file_in, loff_t pos_in,
 
        case OVL_DEDUPE:
                ret = vfs_dedupe_file_range_one(real_in.file, pos_in,
-                                               real_out.file, pos_out, len);
+                                               real_out.file, pos_out, len,
+                                               flags);
                break;
        }
        revert_creds(old_cred);
index 0d1ac1b9bc2230ad3f054d56479b0585c9ba646a..ea30666013b0d86b1d7af852a0e5d81b5c2c18df 100644 (file)
@@ -2010,10 +2010,12 @@ EXPORT_SYMBOL(vfs_dedupe_file_range_compare);
 
 loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
                                 struct file *dst_file, loff_t dst_pos,
-                                loff_t len)
+                                loff_t len, unsigned int remap_flags)
 {
        loff_t ret;
 
+       WARN_ON_ONCE(remap_flags & ~(REMAP_FILE_DEDUP));
+
        ret = mnt_want_write_file(dst_file);
        if (ret)
                return ret;
@@ -2044,7 +2046,7 @@ loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
        }
 
        ret = dst_file->f_op->remap_file_range(src_file, src_pos, dst_file,
-                       dst_pos, len, REMAP_FILE_DEDUP);
+                       dst_pos, len, remap_flags | REMAP_FILE_DEDUP);
 out_drop_write:
        mnt_drop_write_file(dst_file);
 
@@ -2112,7 +2114,8 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
                }
 
                deduped = vfs_dedupe_file_range_one(file, off, dst_file,
-                                                   info->dest_offset, len);
+                                                   info->dest_offset, len,
+                                                   0);
                if (deduped == -EBADE)
                        info->status = FILE_DEDUPE_RANGE_DIFFERS;
                else if (deduped < 0)
index 1c5e55d2a67d30094962a31cf3d0eea4e259c799..544ab5083b4882fb9b019d19569185def657f72c 100644 (file)
@@ -1859,7 +1859,7 @@ extern int vfs_dedupe_file_range(struct file *file,
                                 struct file_dedupe_range *same);
 extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
                                        struct file *dst_file, loff_t dst_pos,
-                                       loff_t len);
+                                       loff_t len, unsigned int remap_flags);
 
 
 struct super_operations {