[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0211d015a215b3d343bfbaad838179c41a1289c5.camel@hammerspace.com>
Date: Thu, 5 Aug 2021 17:43:09 +0000
From: Trond Myklebust <trondmy@...merspace.com>
To: "torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
"dhowells@...hat.com" <dhowells@...hat.com>
CC: "jlayton@...hat.com" <jlayton@...hat.com>,
"willy@...radead.org" <willy@...radead.org>,
"nspmangalore@...il.com" <nspmangalore@...il.com>,
"linux-cifs@...r.kernel.org" <linux-cifs@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"asmadeus@...ewreck.org" <asmadeus@...ewreck.org>,
"anna.schumaker@...app.com" <anna.schumaker@...app.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"miklos@...redi.hu" <miklos@...redi.hu>,
"linux-nfs@...r.kernel.org" <linux-nfs@...r.kernel.org>,
"linux-afs@...ts.infradead.org" <linux-afs@...ts.infradead.org>,
"devel@...ts.orangefs.org" <devel@...ts.orangefs.org>,
"hubcap@...ibond.com" <hubcap@...ibond.com>,
"linux-cachefs@...hat.com" <linux-cachefs@...hat.com>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"sfrench@...ba.org" <sfrench@...ba.org>,
"ceph-devel@...r.kernel.org" <ceph-devel@...r.kernel.org>,
"v9fs-developer@...ts.sourceforge.net"
<v9fs-developer@...ts.sourceforge.net>
Subject: Re: Canvassing for network filesystem write size vs page size
On Thu, 2021-08-05 at 10:27 -0700, Linus Torvalds wrote:
> On Thu, Aug 5, 2021 at 9:36 AM David Howells <dhowells@...hat.com>
> wrote:
> >
> > Some network filesystems, however, currently keep track of which
> > byte ranges
> > are modified within a dirty page (AFS does; NFS seems to also) and
> > only write
> > out the modified data.
>
> NFS definitely does. I haven't used NFS in two decades, but I worked
> on some of the code (read: I made nfs use the page cache both for
> reading and writing) back in my Transmeta days, because NFSv2 was the
> default filesystem setup back then.
>
> See fs/nfs/write.c, although I have to admit that I don't recognize
> that code any more.
>
> It's fairly important to be able to do streaming writes without
> having
> to read the old contents for some loads. And read-modify-write cycles
> are death for performance, so you really want to coalesce writes
> until
> you have the whole page.
>
> That said, I suspect it's also *very* filesystem-specific, to the
> point where it might not be worth trying to do in some generic
> manner.
>
> In particular, NFS had things like interesting credential issues, so
> if you have multiple concurrent writers that used different 'struct
> file *' to write to the file, you can't just mix the writes. You have
> to sync the writes from one writer before you start the writes for
> the
> next one, because one might succeed and the other not.
>
> So you can't just treat it as some random "page cache with dirty byte
> extents". You really have to be careful about credentials, timeouts,
> etc, and the pending writes have to keep a fair amount of state
> around.
>
> At least that was the case two decades ago.
>
> [ goes off and looks. See "nfs_write_begin()" and friends in
> fs/nfs/file.c for some of the examples of these things, althjough it
> looks like the code is less aggressive about avoding the
> read-modify-write case than I thought I remembered, and only does it
> for write-only opens ]
>
All correct, however there is also the issue that even if we have done
a read-modify-write, we can't always extend the write to cover the
entire page.
If you look at nfs_can_extend_write(), you'll note that we don't extend
the page data if the file is range locked, if the attributes have not
been revalidated, or if the page cache contents are suspected to be
invalid for some other reason.
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@...merspace.com
Powered by blists - more mailing lists