]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
block: Catch possible entries missing from hctx_flag_name[]
authorJohn Garry <john.g.garry@oracle.com>
Fri, 19 Jul 2024 11:29:07 +0000 (11:29 +0000)
committerJens Axboe <axboe@kernel.dk>
Fri, 19 Jul 2024 15:32:49 +0000 (09:32 -0600)
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>
Link: https://lore.kernel.org/r/20240719112912.3830443-11-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-debugfs.c
include/linux/blk-mq.h

index 85be8aa39b90ab93b0806d9cfd2a761d73c61e12..8618aa07ba2d533be1d7d327ce92be98b5d5ebcd 100644 (file)
@@ -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])
index 4905a1d6755178f960cb8e5f8c3d8e1b33278af5..27241009c8f9a5e81d824a123d509b3a1cead0c4 100644 (file)
@@ -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) \