[dm-devel] can we reduce bio_set_dev overhead due to bio_associate_blkg?

Mike Snitzer snitzer at redhat.com
Fri Apr 8 15:42:51 UTC 2022


On Thu, Mar 31 2022 at  5:15P -0400,
Christoph Hellwig <hch at infradead.org> wrote:

> On Wed, Mar 30, 2022 at 10:52:13PM -0700, Dennis Zhou wrote:
> > I took a quick look. It seems with the new interface,
> > bio_clone_blkg_association() is unnecessary given the correct
> > association should be derived from the bio_alloc*() calls with the
> > passed in bdev. Also, blkcg_bio_issue_init() in clone seems wrong.
> 
> Yes, I think you are right.
> 
> > Maybe the right thing to do here for md-linear and btrfs (what I've
> > looked at) is to delay cloning until the map occurs and the right device
> > is already in hand?
> 
> That would in general be the preferred option where possible.

Delaying cloning until remap is a problem for DM given the target_type
->map interface for all DM targets assumes the passed bio is already a
clone that needs to be remapped accordingly.

I think we can achieve the goal of efficient cloning/remapping for
both usecases simply by splitting out the bio_set_dev() and leaving it
to the caller to pick which interface to use (e.g. clone vs
clone_and_remap).

Christoph is this something you're open to doing as continuation of
your bio alloc/clone related audit/changes?  Or would you prefer
someone else deal with it?  I could take a closer look next week if
needed.

Mike



More information about the dm-devel mailing list