On 2021/11/23 16:13, Christoph Hellwig wrote:
On Tue, Nov 23, 2021 at 04:10:35PM +0800, Qu Wenruo wrote:
Without bio_chain() sounds pretty good, as we can still utilize
bi_end_io and bi_private.
But this also means, we're now responsible not to release the source bio
since it has the real bi_io_vec.
Just call bio_inc_remaining before submitting the cloned bio, and then
call bio_endio on the root bio every time a clone completes.
Yeah, that sounds pretty good for regular usage.
But there is another very tricky case involved.
For btrfs, it supports zoned device, thus we have special calls sites to
switch between bio_add_page() and bio_add_zoned_append_page().
But zoned write can't not be split, nor there is an easy way to directly
convert a regular bio into a bio with zoned append pages.
Currently if we go the slow path, by allocating a new bio, then add
pages from original bio, and advance the original bio, we're able to do
the conversion from regular bio to zoned append bio.
Any idea on this corner case?
Thanks,
Qu