Linux block layer
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: axboe@kernel.dk, hch@lst.de
Cc: linux-block@vger.kernel.org, bvanassche@acm.org,
	John Garry <john.g.garry@oracle.com>
Subject: [PATCH v3 10/15] block: Catch possible entries missing from hctx_flag_name[]
Date: Fri, 19 Jul 2024 11:29:07 +0000	[thread overview]
Message-ID: <20240719112912.3830443-11-john.g.garry@oracle.com> (raw)
In-Reply-To: <20240719112912.3830443-1-john.g.garry@oracle.com>

Refresh values in BLK_MQ_F_x enum, and then re-arrange members in
hctx_flag_name[] to match that enum. Renumber
BLK_MQ_F_ALLOC_POLICY_START_BIT to match the value refresh.

Add a BUILD_BUG_ON() call to ensure that we are not missing entries in
hctx_flag_name[].

Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 block/blk-mq-debugfs.c |  3 +++
 include/linux/blk-mq.h | 10 ++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 85be8aa39b90..8618aa07ba2d 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -196,6 +196,9 @@ static int hctx_flags_show(void *data, struct seq_file *m)
 	struct blk_mq_hw_ctx *hctx = data;
 	const int alloc_policy = BLK_MQ_FLAG_TO_ALLOC_POLICY(hctx->flags);
 
+	BUILD_BUG_ON(ARRAY_SIZE(hctx_flag_name) !=
+			BLK_MQ_F_ALLOC_POLICY_START_BIT);
+
 	seq_puts(m, "alloc_policy=");
 	if (alloc_policy < ARRAY_SIZE(alloc_policy_name) &&
 	    alloc_policy_name[alloc_policy])
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 4905a1d67551..27241009c8f9 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -644,6 +644,7 @@ struct blk_mq_ops {
 #endif
 };
 
+/* Keep hctx_flag_name[] in sync with the definitions below */
 enum {
 	BLK_MQ_F_SHOULD_MERGE	= 1 << 0,
 	BLK_MQ_F_TAG_QUEUE_SHARED = 1 << 1,
@@ -653,15 +654,16 @@ enum {
 	 */
 	BLK_MQ_F_STACKING	= 1 << 2,
 	BLK_MQ_F_TAG_HCTX_SHARED = 1 << 3,
-	BLK_MQ_F_BLOCKING	= 1 << 5,
+	BLK_MQ_F_BLOCKING	= 1 << 4,
 	/* Do not allow an I/O scheduler to be configured. */
-	BLK_MQ_F_NO_SCHED	= 1 << 6,
+	BLK_MQ_F_NO_SCHED	= 1 << 5,
+
 	/*
 	 * Select 'none' during queue registration in case of a single hwq
 	 * or shared hwqs instead of 'mq-deadline'.
 	 */
-	BLK_MQ_F_NO_SCHED_BY_DEFAULT	= 1 << 7,
-	BLK_MQ_F_ALLOC_POLICY_START_BIT = 8,
+	BLK_MQ_F_NO_SCHED_BY_DEFAULT	= 1 << 6,
+	BLK_MQ_F_ALLOC_POLICY_START_BIT = 7,
 	BLK_MQ_F_ALLOC_POLICY_BITS = 1,
 };
 #define BLK_MQ_FLAG_TO_ALLOC_POLICY(flags) \
-- 
2.31.1


  parent reply	other threads:[~2024-07-19 11:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-19 11:28 [PATCH v3 00/15] block: Catch missing blk-mq debugfs flag array members John Garry
2024-07-19 11:28 ` [PATCH v3 01/15] block: Add missing entries from cmd_flag_name[] John Garry
2024-07-19 11:28 ` [PATCH v3 02/15] block: Add zone write plugging entry to rqf_name[] John Garry
2024-07-19 11:29 ` [PATCH v3 03/15] block: Add missing entry to hctx_flag_name[] John Garry
2024-07-19 11:29 ` [PATCH v3 04/15] block: remove QUEUE_FLAG_STOPPED John Garry
2024-07-19 11:29 ` [PATCH v3 05/15] block: Relocate BLK_MQ_CPU_WORK_BATCH John Garry
2024-07-19 11:29 ` [PATCH v3 06/15] block: Relocate BLK_MQ_MAX_DEPTH John Garry
2024-07-19 11:29 ` [PATCH v3 07/15] block: Make QUEUE_FLAG_x as an enum John Garry
2024-07-19 11:29 ` [PATCH v3 08/15] block: Catch possible entries missing from blk_queue_flag_name[] John Garry
2024-07-19 11:29 ` [PATCH v3 09/15] block: Catch possible entries missing from hctx_state_name[] John Garry
2024-07-19 11:29 ` John Garry [this message]
2024-07-19 11:29 ` [PATCH v3 11/15] block: Catch possible entries missing from alloc_policy_name[] John Garry
2024-07-19 11:29 ` [PATCH v3 12/15] block: Catch possible entries missing from cmd_flag_name[] John Garry
2024-07-19 11:29 ` [PATCH v3 13/15] block: Use enum to define RQF_x bit indexes John Garry
2024-07-19 11:29 ` [PATCH v3 14/15] block: Simplify definition of RQF_NAME() John Garry
2024-07-19 11:29 ` [PATCH v3 15/15] block: Catch possible entries missing from rqf_name[] John Garry
2024-07-19 15:39 ` [PATCH v3 00/15] block: Catch missing blk-mq debugfs flag array members 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=20240719112912.3830443-11-john.g.garry@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --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