Re: [PATCH v2 11/25] fs: Make page_mkwrite_check_truncate thp-aware

From: Matthew Wilcox
Date: Thu Feb 13 2020 - 11:26:36 EST


On Thu, Feb 13, 2020 at 06:44:19PM +0300, Kirill A. Shutemov wrote:
> On Tue, Feb 11, 2020 at 08:18:31PM -0800, Matthew Wilcox wrote:
> > From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx>
> >
> > If the page is compound, check the appropriate indices and return the
> > appropriate sizes.
>
> Is it guarnteed that the page is never called on tail page?

I think so. page_mkwrite_check_truncate() is only called on pages
which belong to a particular filesystem. Only filesystems which have
the FS_LARGE_PAGES flag set will have compound pages allocated in the
page cache for their files. As filesystems are converted, they will
only see large head pages.

I'll happily put in a VM_BUG_ON(PageTail(page), page); to ensure we
don't screw that up.