Christoph Hellwig <hch@xxxxxxxxxxxxx> writes: > On Tue, Oct 08, 2024 at 02:48:43AM -0700, Christoph Hellwig wrote: >> In general I'm not a huge fan of the encoded magic here, but I'll >> need to take a closer look at the caller if I can come up with >> something better. > > I looked a bit more at the code. I'm not entirely sure I fully > understand it yet, but: > > I think most of the read side special casing would be handled by > always submitting the bio at the end of an iomap. Ritesh was > looking into that for supporting ext2-like file systems that > read indirect block ondemand, but I think it actually is fundamentally > the right thing to do anyway. yes, it was... This patch optimizes the data access patterns for filesystems with indirect block mapping by implementing BH_Boundary handling within iomap. Currently the bios for reads within iomap are only submitted at 2 places - 1. If we cannot merge the new req. with previous bio, only then we submit the previous bio. 2. Submit the bio at the end of the entire read processing. This means for filesystems with indirect block mapping, we call into ->iomap_begin() again w/o submitting the previous bios. That causes unoptimized data access patterns for blocks which are of BH_Boundary type. Here is the change which describes this [1]. The implementation part needed to be change to reduce the complexity. Willy gave a better implementation alternative here [2]. [1]: https://lore.kernel.org/all/4e2752e99f55469c4eb5f2fe83e816d529110192.1714046808.git.ritesh.list@xxxxxxxxx/ [2]: https://lore.kernel.org/all/Zivu0gzb4aiazSNu@xxxxxxxxxxxxxxxxxxxx/ Sorry once I am done with the other priority work on my plate - I can resume this work. Meanwhile I would be happy to help if someone would like to work on this. -ritesh