Thread (18 messages) flat view 18 messages, 2 authors, 2021-11-04

Re: [PATCH 3/4] block: move queue enter logic into blk_mq_submit_bio()

From: Jens Axboe <axboe@kernel.dk>
Date: 2021-11-04 17:35:52

On 11/4/21 11:32 AM, Christoph Hellwig wrote:
On Thu, Nov 04, 2021 at 06:14:30AM -0600, Jens Axboe wrote:
quoted
To player it safer, I would suggest we fold in something like the
below. That keeps the submit_checks() under the queue enter.
Yes, this looks much better.  Nit below:
quoted
 	struct block_device *bdev = bio->bi_bdev;
 	struct request_queue *q = bdev_get_queue(bdev);
@@ -868,14 +868,13 @@ static void __submit_bio(struct bio *bio)
 {
 	struct gendisk *disk = bio->bi_bdev->bd_disk;
 
-	if (!submit_bio_checks(bio) || !blk_crypto_bio_prep(&bio))
-		return;
 	if (!disk->fops->submit_bio) {
 		blk_mq_submit_bio(bio);
 	} else {
 		if (unlikely(bio_queue_enter(bio) != 0))
 			return;
-		disk->fops->submit_bio(bio);
+		if (submit_bio_checks(bio) && blk_crypto_bio_prep(&bio))
+			disk->fops->submit_bio(bio);
 		blk_queue_exit(disk->queue);
 	}
A this point moving the whole ->submit_bio based branch into a
helper probably makes sense as well.
Sure, I can do that.
quoted
+	if (unlikely(!blk_crypto_bio_prep(&bio)))
+		return;
+
 	blk_queue_bounce(q, &bio);
 	if (blk_may_split(q, bio))
 		__blk_queue_split(q, &bio, &nr_segs);
@@ -2551,6 +2554,8 @@ void blk_mq_submit_bio(struct bio *bio)
 
 		if (unlikely(!blk_mq_queue_enter(q, bio)))
 			return;
+		if (unlikely(!submit_bio_checks(bio)))
+			goto put_exit;
This now skips the checks for the cached request case, doesn't it?
It did, I did add that when folding it in though.

-- 
Jens Axboe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help