diff options
author | Christoph Hellwig <hch@lst.de> | 2015-11-13 03:38:48 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-11-23 21:53:08 -0500 |
commit | 0f42a6a9b807b092841f7e1b381f8c7e80a0d86a (patch) | |
tree | 532147db78ce2c0d3e495154c08a75c3a01a89c2 | |
parent | 21fad313d5890b674432fe3ad0c7bcf040320340 (diff) |
nfs: use btrfs ioctl defintions for clone
The NFS CLONE_RANGE defintion was wrong and thus never worked. Fix this
by simply using the btrfs ioctl defintion.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r-- | fs/nfs/nfs4file.c | 10 | ||||
-rw-r--r-- | include/uapi/linux/nfs.h | 11 |
2 files changed, 6 insertions, 15 deletions
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 61f1c1c02d06..135353074c25 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/file.h> | 7 | #include <linux/file.h> |
8 | #include <linux/falloc.h> | 8 | #include <linux/falloc.h> |
9 | #include <linux/nfs_fs.h> | 9 | #include <linux/nfs_fs.h> |
10 | #include <uapi/linux/btrfs.h> /* BTRFS_IOC_CLONE/BTRFS_IOC_CLONE_RANGE */ | ||
10 | #include "delegation.h" | 11 | #include "delegation.h" |
11 | #include "internal.h" | 12 | #include "internal.h" |
12 | #include "iostat.h" | 13 | #include "iostat.h" |
@@ -300,12 +301,13 @@ out_drop_write: | |||
300 | 301 | ||
301 | static long nfs42_ioctl_clone_range(struct file *dst_file, void __user *argp) | 302 | static long nfs42_ioctl_clone_range(struct file *dst_file, void __user *argp) |
302 | { | 303 | { |
303 | struct nfs_ioctl_clone_range_args args; | 304 | struct btrfs_ioctl_clone_range_args args; |
304 | 305 | ||
305 | if (copy_from_user(&args, argp, sizeof(args))) | 306 | if (copy_from_user(&args, argp, sizeof(args))) |
306 | return -EFAULT; | 307 | return -EFAULT; |
307 | 308 | ||
308 | return nfs42_ioctl_clone(dst_file, args.src_fd, args.src_off, args.dst_off, args.count); | 309 | return nfs42_ioctl_clone(dst_file, args.src_fd, args.src_offset, |
310 | args.dest_offset, args.src_length); | ||
309 | } | 311 | } |
310 | #else | 312 | #else |
311 | static long nfs42_ioctl_clone(struct file *dst_file, unsigned long srcfd, | 313 | static long nfs42_ioctl_clone(struct file *dst_file, unsigned long srcfd, |
@@ -325,9 +327,9 @@ long nfs4_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
325 | void __user *argp = (void __user *)arg; | 327 | void __user *argp = (void __user *)arg; |
326 | 328 | ||
327 | switch (cmd) { | 329 | switch (cmd) { |
328 | case NFS_IOC_CLONE: | 330 | case BTRFS_IOC_CLONE: |
329 | return nfs42_ioctl_clone(file, arg, 0, 0, 0); | 331 | return nfs42_ioctl_clone(file, arg, 0, 0, 0); |
330 | case NFS_IOC_CLONE_RANGE: | 332 | case BTRFS_IOC_CLONE_RANGE: |
331 | return nfs42_ioctl_clone_range(file, argp); | 333 | return nfs42_ioctl_clone_range(file, argp); |
332 | } | 334 | } |
333 | 335 | ||
diff --git a/include/uapi/linux/nfs.h b/include/uapi/linux/nfs.h index 654bae3f1a38..5e6296160361 100644 --- a/include/uapi/linux/nfs.h +++ b/include/uapi/linux/nfs.h | |||
@@ -33,17 +33,6 @@ | |||
33 | 33 | ||
34 | #define NFS_PIPE_DIRNAME "nfs" | 34 | #define NFS_PIPE_DIRNAME "nfs" |
35 | 35 | ||
36 | /* NFS ioctls */ | ||
37 | /* Let's follow btrfs lead on CLONE to avoid messing userspace */ | ||
38 | #define NFS_IOC_CLONE _IOW(0x94, 9, int) | ||
39 | #define NFS_IOC_CLONE_RANGE _IOW(0x94, 13, int) | ||
40 | |||
41 | struct nfs_ioctl_clone_range_args { | ||
42 | __s64 src_fd; | ||
43 | __u64 src_off, count; | ||
44 | __u64 dst_off; | ||
45 | }; | ||
46 | |||
47 | /* | 36 | /* |
48 | * NFS stats. The good thing with these values is that NFSv3 errors are | 37 | * NFS stats. The good thing with these values is that NFSv3 errors are |
49 | * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which | 38 | * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which |