# Re: iomap: writeback ioend/bio allocation deadlock risk

- From: Ming Lei \<hidden\>
- Date: 2021-05-21 08:35:29 
- List: linux-block
- Page: https://ratatoskr.run/linux-block/2021/05/206376
- Thread: https://ratatoskr.run/linux-block/2021/05/206348/t.md

```text
On Fri, May 21, 2021 at 09:35:47AM +0200, Christoph Hellwig wrote:
> On Fri, May 21, 2021 at 03:31:05PM +0800, Ming Lei wrote:
> > > iomap_ioend_bioset is sized to make sure we can always complete up
> > > to 4 pages, and the list is only used inside a page, so we're fine.
> > 
> > The number itself does not matter, because there isn't any limit on how
> > many ioends can be allocated before submitting, for example, it can be
> > observed that 64 ioends is allocated before submitting when writing
> > 5GB file to ext4. So far the reserved pool size is 32.
> 
> How do you manage to allocate iomap ioends when writing to ext4?  ext4
> doesn't use iomap for buffered I/O.

Just double check, the multiple ioends allocation is from root XFS and
not from big file write to ext4, so looks it can be triggered easily in
background writeback.

> 
> > > fs_bio_set always has two entries to allow exactly for the common
> > > chain and submit pattern.
> > 
> > It is easy to trigger dozens of chained bios in one ioend when writing
> > big file to XFS.
> 
> Yes, we can still have one chained bio per ioend, so we need a bioset
> with the same size as iomap_ioend_bioset.  That still should not be
> dozends for a common setup, though.

Yeah, that can be one solution.

Just wondering why the ioend isn't submitted out after it becomes full?


Thanks, 
Ming

```
