On Mon, Jan 03, 2022 at 11:08:54PM -0800, hch@xxxxxxxxxxxxx wrote: > > + /* > > + * Limit ioend bio chain lengths to minimise IO completion latency. This > > + * also prevents long tight loops ending page writeback on all the pages > > + * in the ioend. > > + */ > > + if (wpc->ioend->io_size >= 4096 * PAGE_SIZE) > > + return false; > > And this stops making sense with the impending additions of large folio > support. I think we need to count the pages/folios instead as the > operations are once per page/folio. I think it's fine to put in a fix like this now that's readily backportable. For folios, I can't help but think we want a restructuring to iterate per-extent first, then per-folio and finally per-sector instead of the current model where we iterate per folio, looking up the extent for each sector. Particularly for the kind of case Trond is talking about here; when we want to fsync(), as long as the entire folio is Uptodate, we want to write the entire thing back. Doing it in portions and merging them back together seems like a lot of wasted effort.