Commit df365836 authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Dave Chinner

vfs: plumb remap flags through the vfs dedupe functions

Plumb a remap_flags argument through the vfs_dedupe_file_range_one
functions so that dedupe can take advantage of it.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 452ce659
...@@ -467,7 +467,8 @@ static loff_t ovl_copyfile(struct file *file_in, loff_t pos_in, ...@@ -467,7 +467,8 @@ static loff_t ovl_copyfile(struct file *file_in, loff_t pos_in,
case OVL_DEDUPE: case OVL_DEDUPE:
ret = vfs_dedupe_file_range_one(real_in.file, pos_in, 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; break;
} }
revert_creds(old_cred); revert_creds(old_cred);
......
...@@ -2010,10 +2010,12 @@ EXPORT_SYMBOL(vfs_dedupe_file_range_compare); ...@@ -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, loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
struct file *dst_file, loff_t dst_pos, struct file *dst_file, loff_t dst_pos,
loff_t len) loff_t len, unsigned int remap_flags)
{ {
loff_t ret; loff_t ret;
WARN_ON_ONCE(remap_flags & ~(REMAP_FILE_DEDUP));
ret = mnt_want_write_file(dst_file); ret = mnt_want_write_file(dst_file);
if (ret) if (ret)
return ret; return ret;
...@@ -2044,7 +2046,7 @@ loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, ...@@ -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, 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: out_drop_write:
mnt_drop_write_file(dst_file); mnt_drop_write_file(dst_file);
...@@ -2112,7 +2114,8 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same) ...@@ -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, deduped = vfs_dedupe_file_range_one(file, off, dst_file,
info->dest_offset, len); info->dest_offset, len,
0);
if (deduped == -EBADE) if (deduped == -EBADE)
info->status = FILE_DEDUPE_RANGE_DIFFERS; info->status = FILE_DEDUPE_RANGE_DIFFERS;
else if (deduped < 0) else if (deduped < 0)
......
...@@ -1859,7 +1859,7 @@ extern int vfs_dedupe_file_range(struct file *file, ...@@ -1859,7 +1859,7 @@ extern int vfs_dedupe_file_range(struct file *file,
struct file_dedupe_range *same); struct file_dedupe_range *same);
extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
struct file *dst_file, loff_t dst_pos, struct file *dst_file, loff_t dst_pos,
loff_t len); loff_t len, unsigned int remap_flags);
struct super_operations { struct super_operations {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment