All of lore.kernel.org
 help / color / mirror / Atom feed
* bio clone submission micro optimizations
@ 2022-05-04 14:29 Christoph Hellwig
  2022-05-04 14:29 ` [PATCH 1/2] block: remove superfluous calls to blkcg_bio_issue_init Christoph Hellwig
  2022-05-04 14:29 ` [PATCH 2/2] block: allow passing a NULL bdev to bio_alloc_clone/bio_init_clone Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Christoph Hellwig @ 2022-05-04 14:29 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Mike Snitzer, linux-block

Hi Jens,

this series has a few minor optimizations forthe bio clone path
that should make life a little easier for Mike in dm.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] block: remove superfluous calls to blkcg_bio_issue_init
  2022-05-04 14:29 bio clone submission micro optimizations Christoph Hellwig
@ 2022-05-04 14:29 ` Christoph Hellwig
  2022-05-04 16:19   ` Mike Snitzer
  2022-05-05  0:30   ` Jens Axboe
  2022-05-04 14:29 ` [PATCH 2/2] block: allow passing a NULL bdev to bio_alloc_clone/bio_init_clone Christoph Hellwig
  1 sibling, 2 replies; 6+ messages in thread
From: Christoph Hellwig @ 2022-05-04 14:29 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Mike Snitzer, linux-block

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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bio.c                 | 1 -
 block/blk-crypto-fallback.c | 1 -
 block/bounce.c              | 1 -
 3 files changed, 3 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index 4259125e16ab2..3cffc01e6377f 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -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;
diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c
index 7c854584b52b5..5ddf33f999dfe 100644
--- a/block/blk-crypto-fallback.c
+++ b/block/blk-crypto-fallback.c
@@ -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;
 }
diff --git a/block/bounce.c b/block/bounce.c
index 467be46d0e656..8f7b6fe3b4db5 100644
--- a/block/bounce.c
+++ b/block/bounce.c
@@ -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;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] block: allow passing a NULL bdev to bio_alloc_clone/bio_init_clone
  2022-05-04 14:29 bio clone submission micro optimizations Christoph Hellwig
  2022-05-04 14:29 ` [PATCH 1/2] block: remove superfluous calls to blkcg_bio_issue_init Christoph Hellwig
@ 2022-05-04 14:29 ` Christoph Hellwig
  2022-05-04 16:20   ` Mike Snitzer
  1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2022-05-04 14:29 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Mike Snitzer, linux-block

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 <hch@lst.de>
---
 block/bio.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index 3cffc01e6377f..23a6838cb97e0 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] block: remove superfluous calls to blkcg_bio_issue_init
  2022-05-04 14:29 ` [PATCH 1/2] block: remove superfluous calls to blkcg_bio_issue_init Christoph Hellwig
@ 2022-05-04 16:19   ` Mike Snitzer
  2022-05-05  0:30   ` Jens Axboe
  1 sibling, 0 replies; 6+ messages in thread
From: Mike Snitzer @ 2022-05-04 16:19 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Jens Axboe, linux-block

On Wed, May 04 2022 at 10:29P -0400,
Christoph Hellwig <hch@lst.de> wrote:

> 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.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Mike Snitzer <snitzer@kernel.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] block: allow passing a NULL bdev to bio_alloc_clone/bio_init_clone
  2022-05-04 14:29 ` [PATCH 2/2] block: allow passing a NULL bdev to bio_alloc_clone/bio_init_clone Christoph Hellwig
@ 2022-05-04 16:20   ` Mike Snitzer
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Snitzer @ 2022-05-04 16:20 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Jens Axboe, linux-block

On Wed, May 04 2022 at 10:29P -0400,
Christoph Hellwig <hch@lst.de> wrote:

> 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 <hch@lst.de>

Reviewed-by: Mike Snitzer <snitzer@kernel.org>

Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] block: remove superfluous calls to blkcg_bio_issue_init
  2022-05-04 14:29 ` [PATCH 1/2] block: remove superfluous calls to blkcg_bio_issue_init Christoph Hellwig
  2022-05-04 16:19   ` Mike Snitzer
@ 2022-05-05  0:30   ` Jens Axboe
  1 sibling, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2022-05-05  0:30 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-block, snitzer

On Wed, 4 May 2022 07:29:49 -0700, Christoph Hellwig wrote:
> 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.
> 
> 

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: 7ecc56c62b27d93838ee67fc2c7a1c3c480aea04

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-05  0:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 14:29 bio clone submission micro optimizations Christoph Hellwig
2022-05-04 14:29 ` [PATCH 1/2] block: remove superfluous calls to blkcg_bio_issue_init Christoph Hellwig
2022-05-04 16:19   ` Mike Snitzer
2022-05-05  0:30   ` Jens Axboe
2022-05-04 14:29 ` [PATCH 2/2] block: allow passing a NULL bdev to bio_alloc_clone/bio_init_clone Christoph Hellwig
2022-05-04 16:20   ` Mike Snitzer

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.