linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.de>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>, Steve French <smfrench@gmail.com>,
	overlayfs <linux-unionfs@vger.kernel.org>,
	Anna Schumaker <Anna.Schumaker@netapp.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: Re: [PATCH 3/3] ovl: Use splice_with_holes in copy_up
Date: Fri, 4 May 2018 08:11:42 +1000	[thread overview]
Message-ID: <20180503221142.GC10363@dastard> (raw)
In-Reply-To: <CAOQ4uxhjhds4avkGBTHsqLp72nWjP=mAFPtxmUarcF1-jp89ng@mail.gmail.com>

On Thu, May 03, 2018 at 10:57:09PM +0300, Amir Goldstein wrote:
> On Thu, May 3, 2018 at 6:26 PM, Goldwyn Rodrigues <rgoldwyn@suse.de> wrote:
> > From: Goldwyn Rodrigues <rgoldwyn@suse.com>
> >
> > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> > ---
> >  fs/overlayfs/copy_up.c |  2 +-
> >  fs/read_write.c        | 10 ++++++----
> >  include/linux/fs.h     |  2 ++
> >  3 files changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
> > index 8bede0742619..6634a85255ae 100644
> > --- a/fs/overlayfs/copy_up.c
> > +++ b/fs/overlayfs/copy_up.c
> > @@ -175,7 +175,7 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len)
> >                         break;
> >                 }
> >
> > -               bytes = do_splice_direct(old_file, &old_pos,
> > +               bytes = splice_with_holes(old_file, &old_pos,
> >                                          new_file, &new_pos,
> >                                          this_len, SPLICE_F_MOVE);
> 
> 
> Add.. you can remove this comment above :)
>         /* FIXME: copy up sparse files efficiently */
> 
> For the record, when I added vfs_clone_file_range() above,
> Dave Chinner has suggested to replace the entire block with
> vfs_copy_file_range(), which would do all the fallbacks.
> Since then, vfs_copy_file_range() gained "try to clone first".

Yup, we want the copy offload infrastructure to be used if at all
possible, so we get consistent behaviour for everyone trying to
optimise copy behaviour.  In this case, I think that it is relevant
that we heard at LSFMM that userspace utils don't want to use
copy_file_range() because it doesn't "optimise for sparse files".

>From that perspective, perhaps this needs "hole preserving copy"
behaviour needs to be moved inside copy-file_range() (and therefore
do_splice_direct()) and triggered by a new flag for
copy_file_range(). e.g. COPY_FILE_SPARSE. That way callers can tell
the kernel they want a sparse copy, and the kernel can attempt that
rather a copy that converts holes to zeros.

In most cases, filesystems that implement efficient offloads already
preserve sparseness, but the do_splice_direct() fallback does not.
If we fix that, then we're a big step closer to getting utilities
like cp and rsync to use copy_file_range() instead of bit shuffling
through userspace to copy data.....

> I am not asking that you do this as part of your work, simply
> pointing out an opportunity.

*nod*

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2018-05-03 22:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 15:26 [PATCH 0/3] Holey splice! copy_file_range() with holes Goldwyn Rodrigues
2018-05-03 15:26 ` [PATCH 1/3] Perform splice in copy_file_range if in/out SB are not same Goldwyn Rodrigues
2018-05-03 15:26 ` [PATCH 2/3] copy_file_range: splice with holes Goldwyn Rodrigues
2018-05-03 15:26 ` [PATCH 3/3] ovl: Use splice_with_holes in copy_up Goldwyn Rodrigues
2018-05-03 19:57   ` Amir Goldstein
2018-05-03 22:11     ` Dave Chinner [this message]
2018-05-04  1:29       ` Goldwyn Rodrigues
2018-05-05 23:16         ` Dave Chinner
2018-05-07 12:16           ` Christoph Hellwig
2018-05-07 23:16             ` Dave Chinner
2018-05-08  4:02               ` Christoph Hellwig
2018-05-08 10:06                 ` Dave Chinner
2018-05-08 16:11                   ` Goldwyn Rodrigues
2018-05-08 16:24                     ` Christoph Hellwig
2018-05-07 18:50           ` Andreas Dilger
2018-05-04  1:29     ` Goldwyn Rodrigues
2018-05-04  1:31     ` Goldwyn Rodrigues
2018-05-04  6:18       ` Amir Goldstein

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=20180503221142.GC10363@dastard \
    --to=david@fromorbit.com \
    --cc=Anna.Schumaker@netapp.com \
    --cc=amir73il@gmail.com \
    --cc=darrick.wong@oracle.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=rgoldwyn@suse.com \
    --cc=rgoldwyn@suse.de \
    --cc=smfrench@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).