archive mirror
 help / color / mirror / Atom feed
From: Al Viro <>
To: David Howells <>
	"Matthew Wilcox (Oracle)" <>,, Jeff Layton <>,
	Andrew W Elble <>,,
Subject: Re: [PATCH v2 0/3] netfs, afs: Fix netfs_write_begin and THP handling
Date: Fri, 18 Jun 2021 03:46:24 +0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Thu, Jun 17, 2021 at 09:23:51AM +0100, David Howells wrote:
> Here are some patches to fix netfs_write_begin() and the handling of THPs in
> that and afs_write_begin/end() in the following ways:
>  (1) Use offset_in_thp() rather than manually calculating the offset into
>      the page.
>  (2) In the future, the len parameter may extend beyond the page allocated.
>      This is because the page allocation is deferred to write_begin() and
>      that gets to decide what size of THP to allocate.
>  (3) In netfs_write_begin(), extract the decision about whether to skip a
>      page out to its own helper and have that clear around the region to be
>      written, but not clear that region.  This requires the filesystem to
>      patch it up afterwards if the hole doesn't get completely filled.
>  (4) Due to (3), afs_write_end() now needs to handle short data write into
>      the page by generic_perform_write().  I've adopted an analogous
>      approach to ceph of just returning 0 in this case and letting the
>      caller go round again.

Series looks sane.  I'd like to hear about the thp-related plans in
more detail, but that's a separate story.

> I wonder if generic_perform_write() should pass in a flag indicating
> whether this is the first attempt or a second attempt at this, and on the
> second attempt we just completely prefill the page and just let the partial
> write stand - which we have to do if the page was already uptodate when we
> started.

Not really - we'll simply get a shorter chunk next time around (with
the patches in -next right now it'll be "the amount we'd actually
managed to copy this time around" in case ->write_begin() tells us
to take a hike), and that shorter chunk is what ->write_begin() will
see.  No need for the flags...

      parent reply	other threads:[~2021-06-18  3:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17  8:23 [PATCH v2 0/3] netfs, afs: Fix netfs_write_begin and THP handling David Howells
2021-06-17  8:24 ` [PATCH v2 1/3] afs: Handle len being extending over page end in write_begin/write_end David Howells
2021-06-21 14:32   ` Matthew Wilcox
2021-06-17  8:24 ` [PATCH v2 2/3] afs: Fix afs_write_end() to handle short writes David Howells
2021-06-21 14:36   ` Matthew Wilcox
2021-06-17  8:24 ` [PATCH v2 3/3] netfs: fix test for whether we can skip read when writing beyond EOF David Howells
2021-06-21 14:50   ` Matthew Wilcox
2021-06-18  3:46 ` Al Viro [this message]

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \ \ \

* 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).