From: Trond Myklebust <trondmy@primarydata.com>
To: "bfields@fieldses.org" <bfields@fieldses.org>,
"kolga@netapp.com" <kolga@netapp.com>
Cc: "hch@infradead.org" <hch@infradead.org>,
Trond Myklebust <trondmy@primarydata.com>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [RFC v1 01/19] fs: Don't copy beyond the end of the file
Date: Wed, 8 Mar 2017 20:18:31 +0000 [thread overview]
Message-ID: <1489004308.3098.10.camel@primarydata.com> (raw)
In-Reply-To: <85310DA6-7270-49AE-A310-76D73678B1B1@netapp.com>
On Wed, 2017-03-08 at 15:00 -0500, Olga Kornievskaia wrote:
> > On Mar 8, 2017, at 2:53 PM, J. Bruce Fields <bfields@fieldses.org>
> > wrote:
> >
> > On Wed, Mar 08, 2017 at 12:32:12PM -0500, Olga Kornievskaia wrote:
> > >
> > > > On Mar 8, 2017, at 12:25 PM, Christoph Hellwig <hch@infradead.o
> > > > rg>
> > > > wrote:
> > > >
> > > > On Wed, Mar 08, 2017 at 12:05:21PM -0500, J. Bruce Fields
> > > > wrote:
> > > > > Since copy isn't atomic that check is never going to be
> > > > > reliable.
> > > >
> > > > That's true for everything that COPY does. By that logic we
> > > > should
> > > > not implement it at all (a logic that I'd fully support)
> > >
> > > If you were to only keep CLONE then you’d lose a huge performance
> > > gain
> > > you get from server-to-server COPY.
> >
> > Yes. Also, I think copy-like copy implementations have reasonable
> > semantics that are basically the same as read:
> >
> > - copy can return successfully with less copied than requested.
> > - it's fine for the copied range to start and/or end past end
> > of
> > file, it'll just return a short read.
> > - A copy of more than 0 bytes returning 0 means you're at end
> > of
> > file.
> >
> > The particular problem here is that that doesn't fit how clone
> > works at
> > all.
> >
> > It feels like what happened is that copy_file_range() was made
> > mainly
> > for the clone case, with the idea that copy might be reluctantly
> > accepted as a second-class implementation.
Historically? No... Christoph added clone as a valid implementation of
copy_file_range() almost a year after Zach and Anna defined the
semantics of vfs_copy_file_range(). git blame is your friend...
> >
> > But the performance gain of copy offload is too big to just ignore,
> > and
> > in fact it's what copy_file_range does on every filesystem but
> > btrfs and
> > ocfs2 (and maybe cifs?), so I don't think we can just ignore it.
> >
> > If we had separate copy_file_range and clone_file_range, I *think*
> > it
> > could all be made sensible. Am I missing something?
> >
>
> How would the application (cp) know when to call the clone_file_range
> and when to call copy_file_range?
cp can probably call copy_file_range(), but any application that needs
atomic semantics (i.e. a binary operation success/fail) must call
clone_file_range().
--
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@primarydata.com
next prev parent reply other threads:[~2017-03-08 20:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170302160123.30375-1-kolga@netapp.com>
[not found] ` <20170302160123.30375-2-kolga@netapp.com>
[not found] ` <20170302162221.GA6854@infradead.org>
[not found] ` <20170303204747.GE13877@fieldses.org>
[not found] ` <4B2A2E86-AFC8-49EA-9D53-7A53AD824CF1@netapp.com>
[not found] ` <20170303213230.GF13877@fieldses.org>
[not found] ` <B3F80DA0-B4F8-4628-88C5-E5C047620F17@netapp.com>
[not found] ` <20170304021008.GB21609@fieldses.org>
[not found] ` <924FF7A2-27CD-4848-BD61-748758C2533F@netapp.com>
2017-03-06 19:23 ` [RFC v1 01/19] Don't copy beyond the end of the file J. Bruce Fields
2017-03-07 14:18 ` Olga Kornievskaia
[not found] ` <20170307234051.GA29977@infradead.org>
[not found] ` <20170308170521.GA1020@fieldses.org>
[not found] ` <20170308172549.GA32011@infradead.org>
[not found] ` <7FDA8E80-3C62-48BB-9E2B-195B4BA340C0@netapp.com>
2017-03-08 19:53 ` [RFC v1 01/19] fs: " J. Bruce Fields
2017-03-08 20:00 ` Olga Kornievskaia
2017-03-08 20:18 ` J. Bruce Fields
2017-03-08 20:18 ` Trond Myklebust [this message]
2017-03-08 20:32 ` bfields
2017-03-08 20:49 ` Trond Myklebust
2017-03-09 15:29 ` bfields
2017-03-09 15:35 ` hch
2017-03-09 16:16 ` bfields
2017-03-09 16:17 ` hch
2017-03-09 17:28 ` Olga Kornievskaia
2017-03-09 18:40 ` bfields
2017-03-09 21:55 ` hch
2017-03-09 17:35 ` Olga Kornievskaia
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=1489004308.3098.10.camel@primarydata.com \
--to=trondmy@primarydata.com \
--cc=bfields@fieldses.org \
--cc=hch@infradead.org \
--cc=kolga@netapp.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.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 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).