OSDN Git Service

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 1c7c133..d9d9240 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 94dc8e6..755c9a3 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 f96f018..9fa35cb 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 fa64e51..c31794f 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 547ef7e..0f40ba5 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 b81c4b7..a8fee2f 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;