On Mon, Sep 22, 2025 at 11:33:54AM -0700, Christoph Hellwig wrote: > On Thu, Sep 18, 2025 at 03:30:18PM -0700, Darrick J. Wong wrote: > > > + iomap_start_folio_read(folio, 1); > > > > I wonder, could you achieve the same effect by elevating > > read_bytes_pending by the number of bytes that we think we have to read, > > and subtracting from it as the completions come in or we decide that no > > read is necessary? > > Weren't we going to look into something like that anyway to stop > the read code from building bios larger than the map to support the > extN boundary conditions? I'm trying to find the details of that, > IIRC willy suggested it. Because once we touch this area for > non-trivial changes it might be a good idea to get that done, or at > least do the prep work. Yes, I did suggest it. Basically, we would initialise read_bytes_pending to folio_size(), then subtract from it either when a request comes in or we decide to memset a hole. When it reaches zero, we have decided on the fate of every byte in the folio. It's fewer atomics for folios which contain no holes, which is the case we should be optimising for anyway.