From: Xianting Tian <tian.xianting@h3c.com>
To: <axboe@kernel.dk>
Cc: <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Xianting Tian <tian.xianting@h3c.com>
Subject: [PATCH] blk-mq: add helper function to test hctx inactive
Date: Wed, 14 Oct 2020 20:56:48 +0800 [thread overview]
Message-ID: <20201014125648.13778-1-tian.xianting@h3c.com> (raw)
Introduce helper function blk_mq_hctx_inactive() to test
BLK_MQ_S_INACTIVE as we already done for BLK_MQ_S_STOPPED.
Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
---
block/blk-mq-tag.c | 2 +-
block/blk-mq.h | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index 32d82e23b..3119572bc 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -153,7 +153,7 @@ unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data)
* Give up this allocation if the hctx is inactive. The caller will
* retry on an active hctx.
*/
- if (unlikely(test_bit(BLK_MQ_S_INACTIVE, &data->hctx->state))) {
+ if (unlikely(blk_mq_hctx_inactive(data->hctx))) {
blk_mq_put_tag(tags, data->ctx, tag + tag_offset);
return BLK_MQ_NO_TAG;
}
diff --git a/block/blk-mq.h b/block/blk-mq.h
index 863a2f334..9813269c2 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -171,6 +171,11 @@ static inline bool blk_mq_hctx_stopped(struct blk_mq_hw_ctx *hctx)
return test_bit(BLK_MQ_S_STOPPED, &hctx->state);
}
+static inline bool blk_mq_hctx_inactive(struct blk_mq_hw_ctx *hctx)
+{
+ return test_bit(BLK_MQ_S_INACTIVE, &hctx->state);
+}
+
static inline bool blk_mq_hw_queue_mapped(struct blk_mq_hw_ctx *hctx)
{
return hctx->nr_ctx && hctx->tags;
--
2.17.1
reply other threads:[~2020-10-14 13:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201014125648.13778-1-tian.xianting@h3c.com \
--to=tian.xianting@h3c.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®