aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2022-02-16 12:45:07 +0800
committerJens Axboe <axboe@kernel.dk>2022-02-16 19:42:27 -0700
commita650628bde77f6ac5b1d532092346feff7b58c52 (patch)
tree0392e8b174b690b85cba8312f968d232b0ecfdc0 /block/blk-core.c
parentdm: remove dm_dispatch_clone_request (diff)
downloadlinux-dev-a650628bde77f6ac5b1d532092346feff7b58c52.tar.xz
linux-dev-a650628bde77f6ac5b1d532092346feff7b58c52.zip
block: move submit_bio_checks() into submit_bio_noacct
It is more clean & readable to check bio when starting to submit it, instead of just before calling ->submit_bio() or blk_mq_submit_bio(). Also it provides us chance to optimize bio submission without checking bio. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Link: https://lore.kernel.org/r/20220216044514.2903784-2-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 5a4a59041629..d4a023667ac1 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -797,9 +797,6 @@ static void __submit_bio(struct bio *bio)
{
struct gendisk *disk = bio->bi_bdev->bd_disk;
- if (unlikely(!submit_bio_checks(bio)))
- return;
-
if (!disk->fops->submit_bio)
blk_mq_submit_bio(bio);
else
@@ -893,6 +890,9 @@ static void __submit_bio_noacct_mq(struct bio *bio)
*/
void submit_bio_noacct(struct bio *bio)
{
+ if (unlikely(!submit_bio_checks(bio)))
+ return;
+
/*
* We only want one ->submit_bio to be active at a time, else stack
* usage with stacked devices could be a problem. Use current->bio_list