Re: don't merge bios over iomap boundaries, was: Re: [PATCH] erofs: prevent buffered read bio merges across device chunks

From: Christoph Hellwig

Date: Fri Jun 12 2026 - 03:10:29 EST


On Fri, Jun 12, 2026 at 02:54:47PM +0800, Gao Xiang wrote:
> hmm, currently erofs could return block-sized iomap (if the chunk
> size is 4k) even it can be merged with the following chunks.
>
> Previously it was fairly good since consecutive chunks will be
> added to the current bio if possible, but after this patch,
> there will be a lot of 4k bios.
>
> But if iomap goes into this way, I could make iomap_begin maps
> more chunks in one shot, but that needs more changes in erofs,
> it's fine anyway.
>
> ... I was thinking the following diff (space-damaged):

That should work too for your case. But we definitively have various
cases where merging over iomaps is a bad idea. You'll also end up with
other efficiency gains by merging consecutive entries, especially for
direct I/O and when using large folios.