]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
block: Catch possible entries missing from cmd_flag_name[]
authorJohn Garry <john.g.garry@oracle.com>
Fri, 19 Jul 2024 11:29:09 +0000 (11:29 +0000)
committerJens Axboe <axboe@kernel.dk>
Fri, 19 Jul 2024 15:32:49 +0000 (09:32 -0600)
Add a BUILD_BUG_ON() call to ensure that we are not missing entries in
cmd_flag_name[].

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240719112912.3830443-13-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-debugfs.c
include/linux/blk_types.h

index 312e8a40caadad97876ac622e0c7f7a41ece23c1..a4accd79c225e9e1946df1045800fbad7373563e 100644 (file)
@@ -281,6 +281,8 @@ int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq)
        const enum req_op op = req_op(rq);
        const char *op_str = blk_op_str(op);
 
+       BUILD_BUG_ON(ARRAY_SIZE(cmd_flag_name) != __REQ_NR_BITS);
+
        seq_printf(m, "%p {.op=", rq);
        if (strcmp(op_str, "UNKNOWN") == 0)
                seq_printf(m, "%u", op);
index 632edd71f8c63ccd98b274cd7defdabc7eeb4701..36ed9613321755f4c7a9e3ed708c51141f1c2e46 100644 (file)
@@ -354,6 +354,7 @@ enum req_op {
        REQ_OP_LAST             = (__force blk_opf_t)36,
 };
 
+/* Keep cmd_flag_name[] in sync with the definitions below */
 enum req_flag_bits {
        __REQ_FAILFAST_DEV =    /* no driver retries of device errors */
                REQ_OP_BITS,