All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: David Howells <dhowells@redhat.com>
Cc: Jeff Layton <jlayton@kernel.org>,
	linux-cachefs@redhat.com, idryomov@gmail.com, pfmeec@rit.edu,
	ceph-devel@vger.kernel.org, Andrew W Elble <aweits@rit.edu>
Subject: Re: [PATCH] netfs: fix test for whether we can skip read when writing beyond EOF
Date: Mon, 14 Jun 2021 12:58:51 +0100	[thread overview]
Message-ID: <YMdEe+d2SA5MBrT7@casper.infradead.org> (raw)
In-Reply-To: <348581.1623671134@warthog.procyon.org.uk>

On Mon, Jun 14, 2021 at 12:45:34PM +0100, David Howells wrote:
> Jeff Layton <jlayton@kernel.org> wrote:
> 
> > > Why not:
> > > 
> > > 	if (page_offset(page) >= i_size)
> > > 
> > 
> > That doesn't handle THP's correctly. It's just a PAGE_SIZE shift.
> 
> I asked Willy about that one and he said it will.  Now, granted, the code
> doesn't seem to do that, but possibly he has a patch for it?

a THP has its index in units of PAGE_SIZE.  If you have an order-4
page at file offset 32 * PAGE_SIZE, it will have page->index set to 32.
So shifting by PAGE_SIZE is correct.  This contrasts with the insanity
of hugetlbfs which has its index in units of the hpage_size.

The only thing is that you have to pass around the head page.  tail->index
is meaningless.  But you should always be passing around the head page
unless there's a really good reason not to (eg vmf->page where we really
need to know which subpage the fault was in).

  reply	other threads:[~2021-06-14 11:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-13 23:33 [PATCH] netfs: fix test for whether we can skip read when writing beyond EOF Jeff Layton
2021-06-14  0:08 ` Matthew Wilcox
2021-06-14  9:50 ` David Howells
2021-06-14 10:04 ` David Howells
2021-06-14 11:35   ` Jeff Layton
2021-06-14 11:45   ` David Howells
2021-06-14 11:58     ` Matthew Wilcox [this message]
2021-06-14 11:51   ` Matthew Wilcox
2021-06-14 10:19 ` David Howells
2021-06-14 10:23 ` David Howells
2021-06-14 12:25 ` David Howells
2021-06-14 12:31   ` Jeff Layton
2021-06-14 12:54   ` Matthew Wilcox

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=YMdEe+d2SA5MBrT7@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=aweits@rit.edu \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=linux-cachefs@redhat.com \
    --cc=pfmeec@rit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.