bio clone submission micro optimizations
Hi Jens,
this series has a few minor optimizations forthe bio clone path that should make life a little easier for Mike in dm.
PATCH 1/2 block: remove superfluous calls to blkcg_bio_issue_init
blkcg_bio_issue_init is called in submit_bio. There is no need to have extra calls that just get overriden in __bio_clone and the two places that copy and pasted from it.
--- block/bio.c | 1 - block/blk-crypto-fallback.c | 1 - block/bounce.c | 1 - 3 files changed, 3 deletions(-)
block/bio.c +0 -1
@@ -739,7 +739,6 @@ static int __bio_clone(struct bio *bio, struct bio *bio_src, gfp_t gfp) bio->bi_iter = bio_src->bi_iter;bio_clone_blkg_association (bio, bio_src); -blkcg_bio_issue_init (bio);if (bio_crypt_clone (bio, bio_src, gfp) <0 )return -ENOMEM ;
block/blk-crypto-fallback.c +0 -1
@@ -177,7 +177,6 @@ static struct bio *blk_crypto_fallback_clone_bio(struct bio *bio_src) bio->bi_io_vec[bio->bi_vcnt++] = bv;bio_clone_blkg_association (bio, bio_src); -blkcg_bio_issue_init (bio);return bio; }
block/bounce.c +0 -1
@@ -191,7 +191,6 @@ static struct bio *bounce_clone_bio(struct bio *bio_src) goto err_put;bio_clone_blkg_association (bio, bio_src); -blkcg_bio_issue_init (bio);return bio;
Signature · 1 line
2.30.2
Re: [PATCH 1/2] block: remove superfluous calls to blkcg_bio_issue_init
Quoted 5 lines · Christoph Hellwig
blkcg_bio_issue_initis called insubmit_bio. There is no need to have extra calls that just get overriden in__bio_cloneand the two places that copy and pasted from it.Signed-off-by Christoph Hellwig <[email protected]>
Re: [PATCH 1/2] block: remove superfluous calls to blkcg_bio_issue_init
In reply to Christoph HellwigQuoted 5 lines · Christoph Hellwig
blkcg_bio_issue_initis called insubmit_bio. There is no need to have extra calls that just get overriden in__bio_cloneand the two places that copy and pasted from it.
Applied, thanks!
[1/2] block: remove superfluous calls to blkcg_bio_issue_init
commit: 513616843d736fb7161b4460cdfe5aa825c5902c
[2/2] block: allow passing a NULL bdev to bio_alloc_clone/bio_init_clone
commit: 7ecc56c62b27d93838ee67fc2c7a1c3c480aea04Best regards,
Signature · 1 line
Jens Axboe
PATCH 2/2 block: allow passing a NULL bdev to bio_alloc_clone/bio_init_clone
In reply to Christoph HellwigDevice mapper wants to allocate a bio before knowing the device it gets send to, so add explicit support for that.
--- block/bio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
block/bio.c +6 -4
@@ -732,13 +732,15 @@ static int __bio_clone(struct bio *bio, struct bio *bio_src, gfp_t gfp)bio_set_flag (bio,BIO_CLONED );if (bio_flagged (bio_src,BIO_THROTTLED ))bio_set_flag (bio,BIO_THROTTLED ); -if (bio->bi_bdev == bio_src->bi_bdev && -bio_flagged (bio_src,BIO_REMAPPED )) -bio_set_flag (bio,BIO_REMAPPED ); bio->bi_ioprio = bio_src->bi_ioprio; bio->bi_iter = bio_src->bi_iter; -bio_clone_blkg_association (bio, bio_src); +if (bio->bi_bdev) { +if (bio->bi_bdev == bio_src->bi_bdev && +bio_flagged (bio_src,BIO_REMAPPED )) +bio_set_flag (bio,BIO_REMAPPED ); +bio_clone_blkg_association (bio, bio_src); + }if (bio_crypt_clone (bio, bio_src, gfp) <0 )return -ENOMEM ;
Signature · 1 line
2.30.2
Re: [PATCH 2/2] block: allow passing a NULL bdev to bio_alloc_clone/bio_init_clone
Quoted 4 lines · Christoph Hellwig
Device mapper wants to allocate a bio before knowing the device it gets send to, so add explicit support for that.
Signed-off-by Christoph Hellwig <[email protected]>
Thanks