diff options
author | Steve French <smfrench@gmail.com> | 2013-11-24 22:53:17 -0500 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2013-11-25 10:50:31 -0500 |
commit | f19e84df37bda502a2248d507a9cf2b9e693279e (patch) | |
tree | 1ff0081b4d9029ef26eed858f1c2e5bc8ae2c47f /fs/cifs | |
parent | ff1c038addc4f205d5f1ede449426c7d316c0eed (diff) |
[CIFS] Do not use btrfs refcopy ioctl for SMB2 copy offload
Change cifs.ko to using CIFS_IOCTL_COPYCHUNK instead
of BTRFS_IOC_CLONE to avoid confusion about whether
copy-on-write is required or optional for this operation.
SMB2/SMB3 copyoffload had used the BTRFS_IOC_CLONE ioctl since
they both speed up copy by offloading the copy rather than
passing many read and write requests back and forth and both have
identical syntax (passing file handles), but for SMB2/SMB3
CopyChunk the server is not required to use copy-on-write
to make a copy of the file (although some do), and Christoph
has commented that since CopyChunk does not require
copy-on-write we should not reuse BTRFS_IOC_CLONE.
This patch renames the ioctl to use a cifs specific IOCTL
CIFS_IOCTL_COPYCHUNK. This ioctl is particularly important
for SMB2/SMB3 since large file copy over the network otherwise
can be very slow, and with this is often more than 100 times
faster putting less load on server and client.
Note that if a copy syscall is ever introduced, depending on
its requirements/format it could end up using one of the other
three methods that CIFS/SMB2/SMB3 can do for copy offload,
but this method is particularly useful for file copy
and broadly supported (not just by Samba server).
Signed-off-by: Steve French <smfrench@gmail.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/ioctl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c index 409b45eefe70..77492301cc2b 100644 --- a/fs/cifs/ioctl.c +++ b/fs/cifs/ioctl.c | |||
@@ -26,13 +26,15 @@ | |||
26 | #include <linux/mount.h> | 26 | #include <linux/mount.h> |
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/pagemap.h> | 28 | #include <linux/pagemap.h> |
29 | #include <linux/btrfs.h> | ||
30 | #include "cifspdu.h" | 29 | #include "cifspdu.h" |
31 | #include "cifsglob.h" | 30 | #include "cifsglob.h" |
32 | #include "cifsproto.h" | 31 | #include "cifsproto.h" |
33 | #include "cifs_debug.h" | 32 | #include "cifs_debug.h" |
34 | #include "cifsfs.h" | 33 | #include "cifsfs.h" |
35 | 34 | ||
35 | #define CIFS_IOCTL_MAGIC 0xCF | ||
36 | #define CIFS_IOC_COPYCHUNK_FILE _IOW(CIFS_IOCTL_MAGIC, 3, int) | ||
37 | |||
36 | static long cifs_ioctl_clone(unsigned int xid, struct file *dst_file, | 38 | static long cifs_ioctl_clone(unsigned int xid, struct file *dst_file, |
37 | unsigned long srcfd, u64 off, u64 len, u64 destoff) | 39 | unsigned long srcfd, u64 off, u64 len, u64 destoff) |
38 | { | 40 | { |
@@ -213,7 +215,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) | |||
213 | cifs_dbg(FYI, "set compress flag rc %d\n", rc); | 215 | cifs_dbg(FYI, "set compress flag rc %d\n", rc); |
214 | } | 216 | } |
215 | break; | 217 | break; |
216 | case BTRFS_IOC_CLONE: | 218 | case CIFS_IOC_COPYCHUNK_FILE: |
217 | rc = cifs_ioctl_clone(xid, filep, arg, 0, 0, 0); | 219 | rc = cifs_ioctl_clone(xid, filep, arg, 0, 0, 0); |
218 | break; | 220 | break; |
219 | default: | 221 | default: |