On Mon, Jun 28, 2021 at 10:59:55PM +0100, Matthew Wilcox wrote: > > > so permit pages without an iop to enter writeback and create an iop > > > *then*. Would that solve your problem? > > > > It is the right thing to do, especially when combined with a feature > > patch to not bother to create the iomap_page structure on small > > block size file systems when the extent covers the whole page. > > We don't know the extent layout at the point where *this* patch creates > iomap_pages during writeback. I imagine we can delay creating one until > we find out what our destination layout will be? Hmm. Actually ->page_mkwrite is always is always called on an uptodate page and we even assert that. I should have remembered the whole page fault path better. So yeah, I think we should take patch 1 from Andreas, then a non-folio version of your patch as a start. The next steps then would be in approximate order: 1. remove the iomap_page_create in iomap_page_mkwrite_actor as it clearly is not needed at that point 2. don't bother to create an iomap_page in iomap_readpage_actor when the iomap spans the whole page 3. don't create the iomap_page in __iomap_write_begin when the page is marked uptodate or the write covers the whole page delaying the creation further in iomap_writepage_map will be harder as the loop around iomap_add_to_ioend is still fundamentally block based.