• Steve French's avatar
    [CIFS] Do not use btrfs refcopy ioctl for SMB2 copy offload · f19e84df
    Steve French authored
    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: default avatarSteve French <smfrench@gmail.com>
    Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
    Reviewed-by: default avatarDavid Disseldorp <ddiss@samba.org>
    f19e84df
ioctl.c 6.5 KB