Re: [PATCH v7 4/9] block: Add core atomic write support

From: Christoph Hellwig
Date: Wed Jun 05 2024 - 04:33:37 EST


On Mon, Jun 03, 2024 at 02:29:26PM +0100, John Garry wrote:
> I think that some of the logic could be re-used.
> rq_straddles_atomic_write_boundary() is checked in merging of reqs/bios (to
> see if the resultant req straddles a boundary).
>
> So instead of saying: "will the resultant req straddle a boundary",
> re-using path like blk_rq_get_max_sectors() -> blk_chunk_sectors_left(), we
> check "is there space within the boundary limit to add this req/bio". We
> need to take care of front and back merges, though.

Yes, we've used the trick to pass in the relevant limit in explicitly
to reuse infrastructure in other places, e.g. max_hw_sectors vs
max_zone_append_sectors for adding to a bio while respecting hardware
limits.