[dm-devel] Any bio_clone_slow() implementation which doesn't share bi_io_vec?

Qu Wenruo quwenruo.btrfs at gmx.com
Wed Nov 24 06:18:00 UTC 2021



On 2021/11/24 14:09, hch at infradead.org wrote:
> On Wed, Nov 24, 2021 at 07:07:18AM +0800, Qu Wenruo wrote:
>> In that case, the missing piece seems to be a way to convert a splitted
>> plain bio into a REQ_OP_ZONE_APPEND bio.
>>
>> Can this be done without slow bvec copying?
>
> Yes.  I have a WIP stacking driver that converts writes to zone appends
> and it does just that:
>
> 	sector_t orig_sector = bio->bi_iter.bi_sector;
> 	unsigned int bio_flags = bio->bi_opf & ~REQ_OP_MASK;
>
> 	...
>
> 	clone = bio_clone_fast(bio, GFP_NOIO, &bdev->write_bio_set);
>
> 	...
>
> 	clone->bi_opf = REQ_OP_ZONE_APPEND | REQ_NOMERGE | bio_flags;

Just so simple? Then that's super awesome.

But I'm a little concerned about the bio_add_hw_page() call in
bio_add_zoned_append().

It's not exactly the same as bio_add_page().

Does it mean as long as our splitted bio doesn't exceed zone limit, we
can do the convert without any further problem?

Thanks,
Qu
> 	bio_set_dev(clone, dev->lower_bdev);
> 	clone->bi_iter.bi_sector = zone_sector;
> 	trace_block_bio_remap(clone, disk_devt(disk), orig_sector);
>
>>
>> Thanks,
>> Qu
> ---end quoted text---
>





More information about the dm-devel mailing list