On Thu, Nov 04, 2021 at 06:14:30AM -0600, Jens Axboe wrote: > 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: > 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. > + 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?