On Tue, Jun 29, 2021 at 06:29:48AM +0100, Christoph Hellwig wrote: > 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 Further thoughts for a better series: 1. create iomap_page if needed in iomap_writepage_map 2. do not create the iomap_page at all in iomap_readpage_actor. ->readahead is always called on newly allocated pages, and ->readpage either on a clean !uptodate page or on one that has seen a write leading to a partial uptodate state. That is for the case that cares about the iomap_page it is present already 3. don't create the iomap_page in iomap_page_mkwrite_actor I think this is the simple initial series that should solve Andreas' problem. Then we can look into optimizing __iomap_write_begin and iomap_writepage_map further as needed.