On 22/12/01 11:35AM, Jan Kara wrote: > On Thu 01-12-22 12:36:55, Ritesh Harjani (IBM) wrote: > > On 22/11/30 05:35PM, Jan Kara wrote: > > > We submit outstanding IO in ext4_bio_write_page() if we find a buffer we > > > are not going to write. This is however pointless because we already > > > handle submission of previous IO in case we detect newly added buffer > > > head is discontiguous. So just delete the pointless IO submission call. > > > > Agreed. io_submit_add_bh() is anyway called at the end for submitting buffers. > > And io_submit_add_bh() also has the logic to: > > 1. submit a discontiguous bio > > 2. Also submit a bio if the bio gets full (submit_and_retry label). > > > > Hence calling ext4_io_submit() early is not required. > > > > I guess the same will also hold true for at this place. > > https://elixir.bootlin.com/linux/v6.1-rc7/source/fs/ext4/page-io.c#L524 > > So there the submission is needed because we are OOM and are going to wait > for some memory to free. If we have some bio accumulated, it is pinning > pages in writeback state and memory reclaim can be waiting on them. So if > we don't submit, it is a deadlock possibility or at least asking for > trouble. Aah! right. I didn't see the ret == -ENOMEM compare there. Thanks! -ritesh