coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/3] Use copy_file_range() for copy


From: Pádraig Brady
Subject: Re: [PATCH 0/3] Use copy_file_range() for copy
Date: Sun, 3 Jun 2018 14:59:05 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 31/05/18 13:42, Goldwyn Rodrigues wrote:
> This is a patch set to use copy_file_range() system call to copy
> file from source to destination. The advantage is lower system time
> because it avoids copy to and from userspace.
> 
> In my tests, I am getting lower system times consumed while performing
> with the copy_file_range.

When copy_file_range() was being proposed I asked for flags
to control how sparse, unallocated, CoW regions were handled.
I still see no flags defined in the latest man pages at least,
so I don't think it's generally usable as is.
It would be good to get confirmation as to how copy_file_range()
currently deals with the 3 region types above.

These cases were discussed previously at:
https://lists.gnu.org/archive/html/coreutils/2015-09/msg00025.html

In regard to reflinking, we might actually change to trying that
by default in cp (mv already does it by default).
The reason being that depending on file system, or physical
device, you may not be actually getting an extra resiliency
from a copy, as an actual copy is not guaranteed.
Now that default change could have significant consequences,
so it would be something that would be most appropriate
in a major version change I think.

For copy() in coreutils, we might do something like:

 if ((remote(dst) && remote(src))
     || sparse_mode==SPARSE_NEVER
     || (sparse_mode!=SPARSE_ALWAYS && !is_sparse(src)))
   ok = copy_file_range()
 else
   ok = reflink()
 if (!ok)
   existing_copy()

thanks!
Pádraig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]