All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: "hch@infradead.org" <hch@infradead.org>
Cc: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	"dm-devel@redhat.com" <dm-devel@redhat.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: Any bio_clone_slow() implementation which doesn't share bi_io_vec?
Date: Wed, 24 Nov 2021 14:18:00 +0800	[thread overview]
Message-ID: <e3fce9af-429c-a1e3-3f0b-4d90fa061d94@gmx.com> (raw)
In-Reply-To: <YZ3XH2PWwrIl/XMy@infradead.org>



On 2021/11/24 14:09, hch@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---
>

WARNING: multiple messages have this Message-ID (diff)
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: "hch@infradead.org" <hch@infradead.org>
Cc: Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	"dm-devel@redhat.com" <dm-devel@redhat.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [dm-devel] Any bio_clone_slow() implementation which doesn't share bi_io_vec?
Date: Wed, 24 Nov 2021 14:18:00 +0800	[thread overview]
Message-ID: <e3fce9af-429c-a1e3-3f0b-4d90fa061d94@gmx.com> (raw)
In-Reply-To: <YZ3XH2PWwrIl/XMy@infradead.org>



On 2021/11/24 14:09, hch@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---
>


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  reply	other threads:[~2021-11-24  6:18 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23  6:44 Any bio_clone_slow() implementation which doesn't share bi_io_vec? Qu Wenruo
2021-11-23  6:44 ` [dm-devel] " Qu Wenruo
2021-11-23  7:43 ` Christoph Hellwig
2021-11-23  7:43   ` [dm-devel] " Christoph Hellwig
2021-11-23  8:10   ` Qu Wenruo
2021-11-23  8:10     ` [dm-devel] " Qu Wenruo
2021-11-23  8:13     ` Christoph Hellwig
2021-11-23  8:13       ` [dm-devel] " Christoph Hellwig
2021-11-23 11:09       ` Qu Wenruo
2021-11-23 11:09         ` [dm-devel] " Qu Wenruo
2021-11-23 11:39         ` Johannes Thumshirn
2021-11-23 11:39           ` [dm-devel] " Johannes Thumshirn
2021-11-23 14:28           ` hch
2021-11-23 14:28             ` [dm-devel] " hch
2021-11-23 23:07             ` Qu Wenruo
2021-11-23 23:07               ` [dm-devel] " Qu Wenruo
2021-11-24  6:09               ` hch
2021-11-24  6:09                 ` [dm-devel] " hch
2021-11-24  6:18                 ` Qu Wenruo [this message]
2021-11-24  6:18                   ` Qu Wenruo
2021-11-24  7:02                   ` hch
2021-11-24  7:02                     ` [dm-devel] " hch
2021-11-24  7:22                     ` hch
2021-11-24  7:22                       ` [dm-devel] " hch
2021-11-24  7:25               ` Naohiro Aota
2021-11-24  7:25                 ` [dm-devel] " Naohiro Aota
2021-11-24  7:39                 ` Qu Wenruo
2021-11-24  7:39                   ` [dm-devel] " Qu Wenruo
2021-11-26 12:33       ` Qu Wenruo
2021-11-26 12:33         ` Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3fce9af-429c-a1e3-3f0b-4d90fa061d94@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=dm-devel@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.