kclient: implement copy_file_range
It’s an in-kernel (or even served-side) copy of data between two files. We should be able to do this by using the copy-from RADOS ops, directed either from the client or the mds.
I’m not sure if FUSE has hooks for this or not, though?
#2 Updated by Luis Henriques about 1 year ago
Zheng Yan wrote:
I think even kernel VFS does not provide hook for this. kernel uses both splice_read and splice_write callbacks to implement this syscall. there is no easy way to combine these two callbacks into one.
The struct file_operations has a .copy_file_range field which nfs and cifs seem to use to implement this. Or did I misunderstood you?
I see there's no one assigned to this feature, so I'll try to spend some time in the next few weeks to have a look and see if this is doable.
#4 Updated by Luis Henriques about 1 year ago
I finally managed to spend some time looking at this, so here's a small update.
I managed to hack libceph to include a ceph_osdc_copy_from function, which I'm able to use to copy an object in a file into an object in a different file. Unfortunately, I'm missing something because when I cat the file I see there's no data there anymore (the file is truncated). If I use 'rados -p cephfs_data_a get <object ID>' I can see that the object has changed and includes the expected contents, but the FS client doesn't see that change (even with an umount/mount).
So... I'm missing something (probably something obvious!). I tried playing with caps, but not luck. Anyway, I'll continue playing a bit more with this.
#5 Updated by Luis Henriques about 1 year ago
And another update: I've managed to implement a copy_file_range PoC, where the RADOS 'copy-from' operation is used (or, at least, partially used as we still need some manual copy when the files offsets (or copy len) aren't object aligned).
The code still requires a good clean-up, specially the cephfs side of it (the actually copy-from code lives in the libceph module and should be mostly ready). I expect to send out an RFC soon.
#6 Updated by Patrick Donnelly about 1 year ago
- Subject changed from Implement file_copy_range to kclient: implement file_copy_range
- Status changed from New to In Progress
- Assignee set to Luis Henriques
- Source set to Development
- Component(FS) kceph added
See "[RFC PATCH 0/2] copy_file_range in cephfs kernel client" on ceph-devel.