vfs: dedupe: rationalize args
authorMiklos Szeredi <mszeredi@redhat.com>
Fri, 6 Jul 2018 21:57:03 +0000 (23:57 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 6 Jul 2018 21:57:03 +0000 (23:57 +0200)
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: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/btrfs/ctree.h
fs/btrfs/ioctl.c
fs/ocfs2/file.c
fs/read_write.c
fs/xfs/xfs_file.c
include/linux/fs.h

index 1c7c13334423f5f372df9f1427a3f894f30075b5..d9d924017dfb5bcb7b59a9196440849f67c76d82 100644 (file)
@@ -3247,8 +3247,9 @@ void btrfs_get_block_group_info(struct list_head *groups_list,
                                struct btrfs_ioctl_space_info *space);
 void btrfs_update_ioctl_balance_args(struct btrfs_fs_info *fs_info,
                               struct btrfs_ioctl_balance_args *bargs);
-int btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen,
-                           struct file *dst_file, u64 dst_loff);
+int btrfs_dedupe_file_range(struct file *src_file, loff_t src_loff,
+                           struct file *dst_file, loff_t dst_loff,
+                           u64 olen);
 
 /* file.c */
 int __init btrfs_auto_defrag_init(void);
index 94dc8e6c44ceee20f23522b2a9dfe844242d3ebf..755c9a306321260739a0f56dab196091cc650655 100644 (file)
@@ -3600,8 +3600,9 @@ out_free:
        return ret;
 }
 
-int btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen,
-                           struct file *dst_file, u64 dst_loff)
+int btrfs_dedupe_file_range(struct file *src_file, loff_t src_loff,
+                           struct file *dst_file, loff_t dst_loff,
+                           u64 olen)
 {
        struct inode *src = file_inode(src_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,
                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,
index f96f018463f778dfdd2bea72863a55e061397d5b..9fa35cb6f6e0b5b38023f45512fc75200be4c694 100644 (file)
@@ -2537,13 +2537,13 @@ static int ocfs2_file_clone_range(struct file *file_in,
                                         len, false);
 }
 
-static int ocfs2_file_dedupe_range(struct file *src_file,
-                                  u64 loff,
-                                  u64 len,
-                                  struct file *dst_file,
-                                  u64 dst_loff)
+static int ocfs2_file_dedupe_range(struct file *file_in,
+                                  loff_t pos_in,
+                                  struct file *file_out,
+                                  loff_t pos_out,
+                                  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);
 }
 
index fa64e51ef4cf477c8bcebb266886fe8396ac0155..c31794f92c2c3712f2087e74b20b2992a84dbf00 100644 (file)
@@ -2049,8 +2049,8 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
                        info->status = -EINVAL;
                } else {
                        deduped = dst_file->f_op->dedupe_file_range(file, off,
-                                                       len, dst_file,
-                                                       info->dest_offset);
+                                                       dst_file,
+                                                       info->dest_offset, len);
                        if (deduped == -EBADE)
                                info->status = FILE_DEDUPE_RANGE_DIFFERS;
                        else if (deduped < 0)
index 547ef7e8aec1fbaa0abbafd2903e3f71bf1b4f1d..0f40ba54d83f6f49b7367d36b8cc10d9ec70cfcb 100644 (file)
@@ -935,13 +935,13 @@ xfs_file_clone_range(
 
 STATIC int
 xfs_file_dedupe_range(
-       struct file     *src_file,
-       u64             loff,
-       u64             len,
-       struct file     *dst_file,
-       u64             dst_loff)
+       struct file     *file_in,
+       loff_t          pos_in,
+       struct file     *file_out,
+       loff_t          pos_out,
+       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);
 }
 
index b81c4b7e339f166d729f578cad3ceace621ece04..a8fee2f449811bdbf0c56f516dd05e89e2a2109c 100644 (file)
@@ -1749,7 +1749,7 @@ struct file_operations {
                        loff_t, size_t, unsigned int);
        int (*clone_file_range)(struct file *, loff_t, struct file *, loff_t,
                        u64);
-       int (*dedupe_file_range)(struct file *, u64, u64, struct file *,
+       int (*dedupe_file_range)(struct file *, loff_t, struct file *, loff_t,
                        u64);
 } __randomize_layout;