Re: [PATCH v11 26/33] mm/writeback: Add folio_wait_writeback()

From: Matthew Wilcox
Date: Wed Jun 16 2021 - 07:56:02 EST


On Wed, Jun 16, 2021 at 11:30:46AM +0100, David Howells wrote:
> Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> wrote:
>
> > + struct page *page = &folio->page;
>
> Isn't that a layering violation? Should it be something like:
>
> struct page *page = folio_head();
>
> or:
>
> struct page *page = folio_subpage(0);

It's not a layering violation, but it is bad style. It indicates the
function is incompletely converted to folios and probably isn't actually
folio-safe. After about a dozen more commits, it's possible to finish
the conversion in afs_page_mkwrite(), and I do so here:

https://git.infradead.org/users/willy/pagecache.git/commitdiff/f49f546f4ad83c8a6fec861af5f9d0825b850abc

It's still not 100% clean as afs_page_dirty() expects a head|base page
instead of a folio, so there's more cleanup required. Also
trace_afs_page_dirty() continues to take a page instead of a folio,
but that tends to not actually be a problem.