ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@hammerspace.com>
To: "torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	"dhowells@redhat.com" <dhowells@redhat.com>
Cc: "jlayton@redhat.com" <jlayton@redhat.com>,
	"willy@infradead.org" <willy@infradead.org>,
	"nspmangalore@gmail.com" <nspmangalore@gmail.com>,
	"linux-cifs@vger.kernel.org" <linux-cifs@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"asmadeus@codewreck.org" <asmadeus@codewreck.org>,
	"anna.schumaker@netapp.com" <anna.schumaker@netapp.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"miklos@szeredi.hu" <miklos@szeredi.hu>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
	"linux-afs@lists.infradead.org" <linux-afs@lists.infradead.org>,
	"devel@lists.orangefs.org" <devel@lists.orangefs.org>,
	"hubcap@omnibond.com" <hubcap@omnibond.com>,
	"linux-cachefs@redhat.com" <linux-cachefs@redhat.com>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"sfrench@samba.org" <sfrench@samba.org>,
	"ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>,
	"v9fs-developer@lists.sourceforge.net" 
	<v9fs-developer@lists.sourceforge.net>
Subject: Re: Canvassing for network filesystem write size vs page size
Date: Thu, 5 Aug 2021 17:43:09 +0000	[thread overview]
Message-ID: <0211d015a215b3d343bfbaad838179c41a1289c5.camel@hammerspace.com> (raw)
In-Reply-To: <CAHk-=wjyEk9EuYgE3nBnRCRd_AmRYVOGACEjt0X33QnORd5-ig@mail.gmail.com>

On Thu, 2021-08-05 at 10:27 -0700, Linus Torvalds wrote:
> On Thu, Aug 5, 2021 at 9:36 AM David Howells <dhowells@redhat.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@hammerspace.com



  reply	other threads:[~2021-08-05 17:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <YQv+iwmhhZJ+/ndc@casper.infradead.org>
     [not found] ` <YQvpDP/tdkG4MMGs@casper.infradead.org>
     [not found]   ` <YQvbiCubotHz6cN7@casper.infradead.org>
     [not found]     ` <1017390.1628158757@warthog.procyon.org.uk>
     [not found]       ` <1170464.1628168823@warthog.procyon.org.uk>
     [not found]         ` <1186271.1628174281@warthog.procyon.org.uk>
2021-08-05 16:35           ` Canvassing for network filesystem write size vs page size David Howells
2021-08-05 17:27             ` Linus Torvalds
2021-08-05 17:43               ` Trond Myklebust [this message]
2021-08-05 22:11               ` Matthew Wilcox
2021-08-06 13:42               ` David Howells
2021-08-06 14:17                 ` Matthew Wilcox
2021-08-06 15:04                 ` David Howells
2021-08-05 17:52             ` Adam Borowski
2021-08-05 18:50             ` Jeff Layton
2021-08-05 23:47             ` Matthew Wilcox
2021-08-06 13:44             ` David Howells

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=0211d015a215b3d343bfbaad838179c41a1289c5.camel@hammerspace.com \
    --to=trondmy@hammerspace.com \
    --cc=anna.schumaker@netapp.com \
    --cc=asmadeus@codewreck.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=devel@lists.orangefs.org \
    --cc=dhowells@redhat.com \
    --cc=hubcap@omnibond.com \
    --cc=jlayton@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=nspmangalore@gmail.com \
    --cc=sfrench@samba.org \
    --cc=torvalds@linux-foundation.org \
    --cc=v9fs-developer@lists.sourceforge.net \
    --cc=willy@infradead.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).