Re: [PATCH 1/1] block: Manage bio references so the bio persists until necessary
From: Christoph Hellwig <hch@infradead.org>
Date: 2020-01-31 06:42:32
Also in:
io-uring
From: Christoph Hellwig <hch@infradead.org>
Date: 2020-01-31 06:42:32
Also in:
io-uring
On Thu, Jan 30, 2020 at 07:23:42PM -0800, Bijan Mottahedeh wrote:
Get a reference to a bio, so it won't be freed if end_io() gets to it before submit_io() returns. Defer the release of the first bio in a mult-bio request until the last end_io() since the first bio is embedded in the dio structure and must therefore persist through an entire multi-bio request.
Can you explain the issue a little more? The initial bio is embedded into the dio, and will have a reference until the bio_put call at the end of the function, so we can't have a race for that one and won't ever need the refcount for the single bio case. Avoiding the atomic is pretty important for aio/uring performance.