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. For the write we plan to add a new IOMAP_BOUNDARY flag to prevent merges as part of the XFS RT group series, and I think this should also solve your problems with keeping one bio per iomap? The current patch is here: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?h=djwong-wtf&id=91b5d7a52dab63732aee451bba0db315ae9bd09b