The Samba-Bugzilla – Bug 12033
smbd should support copy_file_range() for FSCTL_SRV_COPYCHUNK
Last modified: 2017-06-15 11:32:38 UTC
copy_file_range is supported since kernel 4.5. We should check if this call is supported and use it for server side copychung operation.
Interesting also for Kernel 4.7, where the NFS client code also supports that call and can speed up Samba servers with NFS file stores.
Side note: if copy_file_range support is found, btrfs should not override the copy_chunk functions but use the generic code.
with linux kernel 4.8 even xfs will profit immensely from the use of copy_file_range with the introduction of reflink copies.
Created attachment 12912 [details]
patch for master
As just discussed on the phone:
* in vfs_default.c:vfswrap_copy_chunk_send() we should use copy_file_range() if flags does not contain VFS_COPY_CHUNK_FL_MUST_CLONE
* if flags contains VFS_COPY_CHUNK_FL_MUST_CLONE we must use the IOC_CLONE_RANGE ioctl()
* we then can remove the copy_chunk handler from vfs_btrfs