diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-04-14 07:32:02 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-04-16 13:01:42 -0600 |
commit | 9f4107b07b17b5ee68af680150f91227bea2df6f (patch) | |
tree | 54f7074442e4411c2770e09724b288422b95d2e6 /block/blk-core.c | |
parent | 3838c406a594f15600ad6f83c1e3b16bfd1829d0 (diff) |
block: store bdev->bd_disk->fops->submit_bio state in bdev
We have a long chain of memory dereferencing just to whether or not
this disk has a special submit_bio helper. As that's not necessarily
the common case, add a bd_has_submit_bio state in the bdev to avoid
traversing this memory dependency chain if we don't need to.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r-- | block/blk-core.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 269765d16cfd..06bdb352568c 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -587,14 +587,14 @@ static inline blk_status_t blk_check_zone_append(struct request_queue *q, static void __submit_bio(struct bio *bio) { - struct gendisk *disk = bio->bi_bdev->bd_disk; - if (unlikely(!blk_crypto_bio_prep(&bio))) return; - if (!disk->fops->submit_bio) { + if (!bio->bi_bdev->bd_has_submit_bio) { blk_mq_submit_bio(bio); } else if (likely(bio_queue_enter(bio) == 0)) { + struct gendisk *disk = bio->bi_bdev->bd_disk; + disk->fops->submit_bio(bio); blk_queue_exit(disk->queue); } @@ -698,7 +698,7 @@ void submit_bio_noacct_nocheck(struct bio *bio) */ if (current->bio_list) bio_list_add(¤t->bio_list[0], bio); - else if (!bio->bi_bdev->bd_disk->fops->submit_bio) + else if (!bio->bi_bdev->bd_has_submit_bio) __submit_bio_noacct_mq(bio); else __submit_bio_noacct(bio); |