Skip to content

Commit

Permalink
vfs: plumb remap flags through the vfs dedupe functions
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Amir Goldstein <[email protected]>
Signed-off-by: Dave Chinner <[email protected]>
  • Loading branch information
djwong authored and dchinner committed Oct 29, 2018
1 parent 452ce65 commit df36583
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion fs/overlayfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 6 additions & 3 deletions fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit df36583

Please sign in to comment.