All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: Anna Schumaker
	<Anna.Schumaker-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	zab-ugsP4Wv/S6ZeoWH0uzbU5w@public.gmane.org,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org,
	clm-b10kYP2dOMg@public.gmane.org,
	darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
	mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	andros-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org,
	hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org
Subject: Re: [PATCH v3 8/9] vfs: copy_file_range() can do a pagecache copy with splice
Date: Fri, 25 Sep 2015 22:58:42 +0100	[thread overview]
Message-ID: <5605C392.80008@draigBrady.com> (raw)
In-Reply-To: <1443214096-12769-9-git-send-email-Anna.Schumaker-ZwjVKphTwtPQT0dZR+AlfA@public.gmane.org>

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 <Anna.Schumaker-ZwjVKphTwtPQT0dZR+AlfA@public.gmane.org>

Reviewed-by: Pádraig Brady <P@draigBrady.com>

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.

WARNING: multiple messages have this Message-ID (diff)
From: "Pádraig Brady" <P@draigBrady.com>
To: Anna Schumaker <Anna.Schumaker@netapp.com>,
	linux-nfs@vger.kernel.org, linux-btrfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
	zab@zabbo.net, viro@zeniv.linux.org.uk, clm@fb.com,
	darrick.wong@oracle.com, mtk.manpages@gmail.com,
	andros@netapp.com, hch@infradead.org
Subject: Re: [PATCH v3 8/9] vfs: copy_file_range() can do a pagecache copy with splice
Date: Fri, 25 Sep 2015 22:58:42 +0100	[thread overview]
Message-ID: <5605C392.80008@draigBrady.com> (raw)
In-Reply-To: <1443214096-12769-9-git-send-email-Anna.Schumaker@Netapp.com>

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 <Anna.Schumaker@Netapp.com>

Reviewed-by: Pádraig Brady <P@draigBrady.com>

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.

  parent reply	other threads:[~2015-09-25 21:58 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 20:48 [PATCH v3 0/9] VFS: In-kernel copy system call Anna Schumaker
2015-09-25 20:48 ` Anna Schumaker
2015-09-25 20:48 ` Anna Schumaker
2015-09-25 20:48 ` [PATCH v3 1/9] vfs: add copy_file_range syscall and vfs helper Anna Schumaker
2015-09-25 20:48   ` Anna Schumaker
2015-09-25 20:48 ` [PATCH v3 2/9] x86: add sys_copy_file_range to syscall tables Anna Schumaker
2015-09-25 20:48   ` Anna Schumaker
2015-09-25 20:48 ` [PATCH v3 3/9] btrfs: add .copy_file_range file operation Anna Schumaker
2015-09-25 20:48   ` Anna Schumaker
2015-09-25 20:48 ` [PATCH v3 4/9] vfs: Copy should check len after file open mode Anna Schumaker
2015-09-25 20:48   ` Anna Schumaker
2015-09-25 20:48 ` [PATCH v3 5/9] vfs: Copy shouldn't forbid ranges inside the same file Anna Schumaker
2015-09-25 20:48   ` Anna Schumaker
2015-09-28 18:46   ` Darrick J. Wong
     [not found] ` <1443214096-12769-1-git-send-email-Anna.Schumaker-ZwjVKphTwtPQT0dZR+AlfA@public.gmane.org>
2015-09-25 20:48   ` [PATCH v3 6/9] vfs: Copy should use file_out rather than file_in Anna Schumaker
2015-09-25 20:48     ` Anna Schumaker
2015-09-25 20:48     ` Anna Schumaker
2015-09-25 20:48 ` [PATCH v3 7/9] vfs: Remove copy_file_range mountpoint checks Anna Schumaker
2015-09-25 20:48   ` Anna Schumaker
2015-09-25 20:48 ` [PATCH v3 8/9] vfs: copy_file_range() can do a pagecache copy with splice Anna Schumaker
2015-09-25 20:48   ` Anna Schumaker
     [not found]   ` <1443214096-12769-9-git-send-email-Anna.Schumaker-ZwjVKphTwtPQT0dZR+AlfA@public.gmane.org>
2015-09-25 21:58     ` Pádraig Brady [this message]
2015-09-25 21:58       ` Pádraig Brady
2015-09-28 18:31     ` Darrick J. Wong
2015-09-28 18:31       ` Darrick J. Wong
     [not found]       ` <20150928183152.GB850-PTl6brltDGh4DFYR7WNSRA@public.gmane.org>
2015-09-28 18:35         ` Anna Schumaker
2015-09-28 18:35           ` Anna Schumaker
2015-09-28 18:35           ` Anna Schumaker
2015-09-26  0:14   ` Andy Lutomirski
2015-09-28 14:28     ` Anna Schumaker
2015-09-28 14:28       ` Anna Schumaker
2015-09-25 20:48 ` [PATCH v3 9/9] btrfs: btrfs_copy_file_range() only supports reflinks Anna Schumaker
2015-09-25 20:48   ` Anna Schumaker
2015-09-25 20:48 ` [PATCH v3 10/9] copy_file_range.2: New page documenting copy_file_range() Anna Schumaker
2015-09-25 20:48   ` Anna Schumaker
2015-09-28 18:40   ` Darrick J. Wong
2015-09-28 20:42     ` Anna Schumaker
2015-09-28 20:42       ` Anna Schumaker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5605C392.80008@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=Anna.Schumaker-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org \
    --cc=andros-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org \
    --cc=clm-b10kYP2dOMg@public.gmane.org \
    --cc=darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    --cc=zab-ugsP4Wv/S6ZeoWH0uzbU5w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.