Project

General

Profile

Actions

Feature #21944

closed

kclient: implement copy_file_range

Added by Greg Farnum over 6 years ago. Updated about 5 years ago.

Status:
Resolved
Priority:
Normal
Category:
fs/ceph
Target version:
-
% Done:

0%

Source:
Development
Tags:
Backport:
Reviewed:
Affected Versions:

Description

http://man7.org/linux/man-pages/man2/copy_file_range.2.html

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?

Actions #1

Updated by Zheng Yan over 6 years ago

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.

Actions #2

Updated by Luis Henriques almost 6 years 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.

Actions #3

Updated by Zheng Yan almost 6 years ago

glad to hear, thanks

Actions #4

Updated by Luis Henriques almost 6 years 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.

Actions #5

Updated by Luis Henriques almost 6 years 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.

Actions #6

Updated by Patrick Donnelly over 5 years 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.

Actions #7

Updated by Luis Henriques over 5 years ago

  • Subject changed from kclient: implement file_copy_range to kclient: implement copy_range_range
Actions #8

Updated by Luis Henriques over 5 years ago

  • Subject changed from kclient: implement copy_range_range to kclient: implement copy_file_range
Actions #9

Updated by Patrick Donnelly about 5 years ago

  • Project changed from CephFS to Linux kernel client
  • Start date deleted (10/27/2017)
Actions #10

Updated by Ilya Dryomov about 5 years ago

  • Category set to fs/ceph
  • Status changed from In Progress to Resolved

In 4.20, but the copyfrom optimization was subsequently disabled due to https://tracker.ceph.com/issues/37378.

Actions

Also available in: Atom PDF