archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <>
To: David Howells <>
	Andrew W Elble <>, Jeff Layton <>,,,
Subject: Re: [PATCH v2 3/3] netfs: fix test for whether we can skip read when writing beyond EOF
Date: Mon, 21 Jun 2021 15:50:49 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Thu, Jun 17, 2021 at 09:24:27AM +0100, David Howells wrote:
> From: Jeff Layton <>
> It's not sufficient to skip reading when the pos is beyond the EOF.
> There may be data at the head of the page that we need to fill in
> before the write.
> Add a new helper function that corrects and clarifies the logic of
> when we can skip reads, and have it only zero out the part of the page
> that won't have data copied in for the write.
> Finally, don't set the page Uptodate after zeroing. It's not up to date
> since the write data won't have been copied in yet.
> [DH made the following changes:
>  - Prefixed the new function with "netfs_".
>  - Don't call zero_user_segments() for a full-page write.
>  - Altered the beyond-last-page check to avoid a DIV instruction and got
>    rid of then-redundant zero-length file check.
> ]
> Fixes: e1b1240c1ff5f ("netfs: Add write_begin helper")
> Reported-by: Andrew W Elble <>
> Signed-off-by: Jeff Layton <>
> Signed-off-by: David Howells <>
> cc:
> Link:
> Link: # v1

Reviewed-by: Matthew Wilcox (Oracle) <>

  reply	other threads:[~2021-06-21 14:51 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 [this message]
2021-06-18  3:46 ` [PATCH v2 0/3] netfs, afs: Fix netfs_write_begin and THP handling Al Viro

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