Commit 87eb5eb2 authored by Miklos Szeredi's avatar Miklos Szeredi

vfs: dedupe: rationalize args

Clean up f_op->dedupe_file_range() interface.

1) Use loff_t for offsets and length instead of u64
2) Order the arguments the same way as {copy|clone}_file_range().
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 5740c99e
...@@ -3247,8 +3247,9 @@ void btrfs_get_block_group_info(struct list_head *groups_list, ...@@ -3247,8 +3247,9 @@ void btrfs_get_block_group_info(struct list_head *groups_list,
struct btrfs_ioctl_space_info *space); struct btrfs_ioctl_space_info *space);
void btrfs_update_ioctl_balance_args(struct btrfs_fs_info *fs_info, void btrfs_update_ioctl_balance_args(struct btrfs_fs_info *fs_info,
struct btrfs_ioctl_balance_args *bargs); struct btrfs_ioctl_balance_args *bargs);
int btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen, int btrfs_dedupe_file_range(struct file *src_file, loff_t src_loff,
struct file *dst_file, u64 dst_loff); struct file *dst_file, loff_t dst_loff,
u64 olen);
/* file.c */ /* file.c */
int __init btrfs_auto_defrag_init(void); int __init btrfs_auto_defrag_init(void);
......
...@@ -3600,8 +3600,9 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen, ...@@ -3600,8 +3600,9 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen,
return ret; return ret;
} }
int btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen, int btrfs_dedupe_file_range(struct file *src_file, loff_t src_loff,
struct file *dst_file, u64 dst_loff) struct file *dst_file, loff_t dst_loff,
u64 olen)
{ {
struct inode *src = file_inode(src_file); struct inode *src = file_inode(src_file);
struct inode *dst = file_inode(dst_file); struct inode *dst = file_inode(dst_file);
...@@ -3616,7 +3617,7 @@ int btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen, ...@@ -3616,7 +3617,7 @@ int btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen,
return -EINVAL; return -EINVAL;
} }
return btrfs_extent_same(src, loff, olen, dst, dst_loff); return btrfs_extent_same(src, src_loff, olen, dst, dst_loff);
} }
static int clone_finish_inode_update(struct btrfs_trans_handle *trans, static int clone_finish_inode_update(struct btrfs_trans_handle *trans,
......
...@@ -2537,13 +2537,13 @@ static int ocfs2_file_clone_range(struct file *file_in, ...@@ -2537,13 +2537,13 @@ static int ocfs2_file_clone_range(struct file *file_in,
len, false); len, false);
} }
static int ocfs2_file_dedupe_range(struct file *src_file, static int ocfs2_file_dedupe_range(struct file *file_in,
u64 loff, loff_t pos_in,
u64 len, struct file *file_out,
struct file *dst_file, loff_t pos_out,
u64 dst_loff) u64 len)
{ {
return ocfs2_reflink_remap_range(src_file, loff, dst_file, dst_loff, return ocfs2_reflink_remap_range(file_in, pos_in, file_out, pos_out,
len, true); len, true);
} }
......
...@@ -2049,8 +2049,8 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same) ...@@ -2049,8 +2049,8 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
info->status = -EINVAL; info->status = -EINVAL;
} else { } else {
deduped = dst_file->f_op->dedupe_file_range(file, off, deduped = dst_file->f_op->dedupe_file_range(file, off,
len, dst_file, dst_file,
info->dest_offset); info->dest_offset, len);
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)
......
...@@ -935,13 +935,13 @@ xfs_file_clone_range( ...@@ -935,13 +935,13 @@ xfs_file_clone_range(
STATIC int STATIC int
xfs_file_dedupe_range( xfs_file_dedupe_range(
struct file *src_file, struct file *file_in,
u64 loff, loff_t pos_in,
u64 len, struct file *file_out,
struct file *dst_file, loff_t pos_out,
u64 dst_loff) u64 len)
{ {
return xfs_reflink_remap_range(src_file, loff, dst_file, dst_loff, return xfs_reflink_remap_range(file_in, pos_in, file_out, pos_out,
len, true); len, true);
} }
......
...@@ -1749,7 +1749,7 @@ struct file_operations { ...@@ -1749,7 +1749,7 @@ struct file_operations {
loff_t, size_t, unsigned int); loff_t, size_t, unsigned int);
int (*clone_file_range)(struct file *, loff_t, struct file *, loff_t, int (*clone_file_range)(struct file *, loff_t, struct file *, loff_t,
u64); u64);
int (*dedupe_file_range)(struct file *, u64, u64, struct file *, int (*dedupe_file_range)(struct file *, loff_t, struct file *, loff_t,
u64); u64);
} __randomize_layout; } __randomize_layout;
......
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