Thread (1 message) 1 message, 1 author, 2015-09-25

Re: [PATCH v3 8/9] vfs: copy_file_range() can do a pagecache copy with splice

From: Pádraig Brady <hidden>
Date: 2015-09-25 21:58:42
Also in: linux-btrfs, linux-fsdevel, linux-nfs

On 25/09/15 21:48, Anna Schumaker wrote:
The NFS server will need some kind offallback for filesystems that don't
have any kind of copy acceleration, and it should be generally useful to
have an in-kernel copy to avoid lots of switches between kernel and user
space.

I make this configurable by adding two new flags.  Users who only want a
reflink can pass COPY_FR_REFLINK, and users who want a full data copy can
pass COPY_FR_COPY.  The default (flags=0) means to first attempt a
reflink, but use the pagecache if that fails.

I moved the rw_verify_area() calls into the fallback code since some
filesystems can handle reflinking a large range.

Signed-off-by: Anna Schumaker <redacted>
Reviewed-by: Pádraig Brady <redacted>

LGTM. For my reference, for cp(1), mv(1), install(1), this will avoid
user space copies in the normal case, client side copies in the network
file system case, and provide a more generalized interface to reflink().

coreutils pseudo code is:

  unsigned int cfr_flags = COPY_FR_COPY;
  if (mode == mv)
    cfr_flags = 0; /* reflink falling back to normal */
  else if (mode == cp) {
    if --reflink || --reflink==always
      cfr_flags = COPY_FR_REFLINK;
    else if --reflink==auto
      cfr_flags = 0; /* reflink falling back to normal */
  }
  if vfs_copy_file_range(..., cfr_flags) == ENOTSUP
    normal_user_space_copy();

thanks,
Pádraig.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help