Subject: Re: bug#24399: FICLONE for coreutils; copy_file_range?

From: Pádraig Brady <[email-masked]>
Date: Sat, 10 Sep 2016 11:05:00 +0100

On 09/09/16 23:46, Paul Eggert wrote:
> I installed the attached patch so that cp etc. can use the FICLONE API 
> that appears to be what the Linux kernel has standardized on for this 
> sort of thing.

Nice thanks.
This is just renaming as the kernel used
the same ABI as for the BTRFS ioctl.

> I notice that the Linux 4.5 kernel has added a copy_file_range syscall 
> that is said to clone in some cases, but this isn't yet declared in the 
> /usr/include headers on Fedora 24 (4.7.2 kernel). Also, its man page 
> says it uses a size_t (not off_t) to count the number of bytes to be 
> copied, which is a strange choice for a file-copying API. What's up with 
> that?

I've been monitoring that syscall a bit.
It will be very useful for efficient server side only copying,
and can take advantage of reflinking where available.
I was pushing for more control flags for dealing with reflinking
and handling of holes, but that was rejected in the first iteration at least.
One quite awkward thing at present is if the file system doesn't
implement the syscall, it falls back to do_splice_direct
which is basically sendfile(), and that will expand holes.

thanks,
Pádraig