From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Li Ning <lining2020x@163.com>,
Tejun Heo <tj@kernel.org>, Chunguang Xu <brookxu@tencent.com>,
Ming Lei <ming.lei@redhat.com>
Subject: [PATCH V2 2/7] block: move blk_crypto_bio_prep() out of blk-mq.c
Date: Wed, 9 Feb 2022 17:14:24 +0800 [thread overview]
Message-ID: <20220209091429.1929728-3-ming.lei@redhat.com> (raw)
In-Reply-To: <20220209091429.1929728-1-ming.lei@redhat.com>
blk_crypto_bio_prep() is called for both bio based and blk-mq drivers,
so move it out of blk-mq.c, then we can unify this kind of handling.
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
block/blk-core.c | 18 ++++++------------
block/blk-mq.c | 3 ---
2 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index bf989b1b3bea..1514dbab0bd8 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -786,26 +786,20 @@ noinline_for_stack bool submit_bio_checks(struct bio *bio)
return false;
}
-static void __submit_bio_fops(struct gendisk *disk, struct bio *bio)
+static void __submit_bio(struct bio *bio)
{
if (blk_crypto_bio_prep(&bio)) {
- if (likely(bio_queue_enter(bio) == 0)) {
+ struct gendisk *disk = bio->bi_bdev->bd_disk;
+
+ if (!disk->fops->submit_bio) {
+ blk_mq_submit_bio(bio);
+ } else if (likely(bio_queue_enter(bio) == 0)) {
disk->fops->submit_bio(bio);
blk_queue_exit(disk->queue);
}
}
}
-static void __submit_bio(struct bio *bio)
-{
- struct gendisk *disk = bio->bi_bdev->bd_disk;
-
- if (!disk->fops->submit_bio)
- blk_mq_submit_bio(bio);
- else
- __submit_bio_fops(disk, bio);
-}
-
/*
* The loop in this function may be a bit non-obvious, and so deserves some
* explanation:
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4b868e792ba4..fa1c38a05d5a 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2786,9 +2786,6 @@ void blk_mq_submit_bio(struct bio *bio)
unsigned int nr_segs = 1;
blk_status_t ret;
- 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);
--
2.31.1
next prev parent reply other threads:[~2022-02-09 9:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 9:14 [PATCH V2 0/7] block: improve iops limit throttle Ming Lei
2022-02-09 9:14 ` [PATCH V2 1/7] block: move submit_bio_checks() into submit_bio_noacct Ming Lei
2022-02-09 14:01 ` Christoph Hellwig
2022-02-09 9:14 ` Ming Lei [this message]
2022-02-09 14:02 ` [PATCH V2 2/7] block: move blk_crypto_bio_prep() out of blk-mq.c Christoph Hellwig
2022-02-09 9:14 ` [PATCH V2 3/7] block: don't declare submit_bio_checks in local header Ming Lei
2022-02-09 14:02 ` Christoph Hellwig
2022-02-09 9:14 ` [PATCH V2 4/7] block: don't check bio in blk_throtl_dispatch_work_fn Ming Lei
2022-02-09 14:03 ` Christoph Hellwig
2022-02-09 9:14 ` [PATCH V2 5/7] block: throttle split bio in case of iops limit Ming Lei
2022-02-14 20:22 ` Tejun Heo
2022-02-15 1:10 ` Ming Lei
2022-02-15 7:08 ` Christoph Hellwig
2022-02-15 8:02 ` Ming Lei
2022-02-15 8:17 ` Ning Li
2022-02-15 8:20 ` Ning Li
2022-02-09 9:14 ` [PATCH V2 6/7] block: don't try to throttle split bio if iops limit isn't set Ming Lei
2022-02-09 9:14 ` [PATCH V2 7/7] block: revert 4f1e9630afe6 ("blk-throtl: optimize IOPS throttle for large IO scenarios") Ming Lei
2022-02-13 8:34 ` [PATCH V2 0/7] block: improve iops limit throttle Ming Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220209091429.1929728-3-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=brookxu@tencent.com \
--cc=lining2020x@163.com \
--cc=linux-block@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).