Re: [PATCH 5/9] iomap: Support arbitrarily many blocks per page

From: Matthew Wilcox
Date: Mon Aug 24 2020 - 20:22:28 EST


On Tue, Aug 25, 2020 at 09:59:18AM +1000, Dave Chinner wrote:
> On Mon, Aug 24, 2020 at 03:55:06PM +0100, Matthew Wilcox (Oracle) wrote:
> > static inline struct iomap_page *to_iomap_page(struct page *page)
> > {
> > + VM_BUG_ON_PGFLAGS(PageTail(page), page);
> > if (page_has_private(page))
> > return (struct iomap_page *)page_private(page);
> > return NULL;
>
> Just to confirm: this vm bug check is to needed becuse we only
> attach the iomap_page to the head page of a compound page?
>
> Assuming that I've understood the above correctly:

That's correct. If we get a tail page in this path, something's gone
wrong somewhere upstream of us, and the stack trace should tell us where.
It's PGFLAGS so it's usually compiled out by distro kernels (you need to
enable CONFIG_DEBUG_VM_PGFLAGS for it to be active).

It was definitely useful in development; probably not so useful for
a distro kernel to assert.