Re: [PATCH] netfs: fix test for whether we can skip read when writing beyond EOF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 14, 2021 at 12:45:34PM +0100, David Howells wrote:
> Jeff Layton <jlayton@xxxxxxxxxx> 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).



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux