Simplify copy-reflink code

David Disseldorp ddiss at samba.org
Thu Apr 4 01:58:40 UTC 2024


Hi Ralph,

On Tue, 2 Apr 2024 15:43:44 +0200, Ralph Boehme via samba-technical wrote:

> Hi David,
> 
> thanks for taking a look!
> 
> On 4/2/24 11:26, David Disseldorp wrote:
> > Sounds good to me, although I'll need a bit of time this week to take a
> > look (and do some testing).  
> 
> that would be awesome!
> 
> > If it's passing the copy-chunk & dup-extent
> > torture tests on a btrfs-backed share, then I'm confident that it should
> > be fine.   
> 
> yes, they're still passing.
> 
> > However, my confidence in the tests is reduced - I thought they
> > exercised the BTRFS_IOC_CLONE_RANGE fallback code-path, so should have
> > caught [1]. Perhaps it's just that nobody tests atop btrfs?  
> 
> I guess for the common workload of copying files the fallback is just 
> never triggered.

I had a quick play with your changes. BTRFS_IOC_CLONE_RANGE fallback is
triggered by the existing smb2.ioctl.copy_chunk_tiny test. strace
indicates that it's doing the right thing on the syscall side before and
after your 48d8b9c7ad5 ("vfs_btrfs: fix BTRFS_IOC_CLONE_RANGE fallback")
change (with ret = -1 reverted back to ret = ioctl...):
  ioctl(30, BTRFS_IOC_CLONE_RANGE , {src_fd=28, src_offset=0, src_length=48, dest_offset=0}) = -1 EINVAL
  ...
  copy_file_range(28, [0], 30, [0], 48, 0) = 48

Cheers, David



More information about the samba-technical mailing list