From: Jens Axboe <axboe@kernel.dk>
To: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: [PATCH] block: avoid clearing blk_mq_alloc_data unnecessarily
Date: Fri, 3 Dec 2021 08:48:09 -0700 [thread overview]
Message-ID: <1ba89cb7-e53c-78c3-1fe4-db9908851e63@kernel.dk> (raw)
We already set almost all of what we need here, just the non-plug
path needs to set nr_tags and clear cached.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4dc0837f874d..eba34af1c5eb 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2664,7 +2664,7 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
{
struct blk_mq_alloc_data data = {
.q = q,
- .nr_tags = 1,
+ .shallow_depth = 0
};
struct request *rq;
@@ -2683,6 +2683,9 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
data.nr_tags = plug->nr_ios;
plug->nr_ios = 1;
data.cached_rq = &plug->cached_rq;
+ } else {
+ data.nr_tags = 1;
+ data.cached_rq = NULL;
}
rq = __blk_mq_alloc_requests(&data);
--
Jens Axboe
next reply other threads:[~2021-12-03 15:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-03 15:48 Jens Axboe [this message]
2021-12-06 6:59 ` [PATCH] block: avoid clearing blk_mq_alloc_data unnecessarily Christoph Hellwig
2021-12-06 16:34 ` Jens Axboe
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=1ba89cb7-e53c-78c3-1fe4-db9908851e63@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-block@vger.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