diff mbox series

[11/11] block: Catch possible entries missing from rqf_name[]

Message ID 20240709110538.532896-12-john.g.garry@oracle.com (mailing list archive)
State New, archived
Headers show
Series block debugfs: Catch missing flag array members | expand

Commit Message

John Garry July 9, 2024, 11:05 a.m. UTC
Also add a BUILD_BUG_ON() call to ensure that we are not missing entries
in rqf_name[].

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

Patch

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 97741996b5f2..c829406579ee 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -280,6 +280,7 @@  int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq)
 	const char *op_str = blk_op_str(op);
 
 	BUILD_BUG_ON(ARRAY_SIZE(cmd_flag_name) != __REQ_NR_BITS);
+	BUILD_BUG_ON(ARRAY_SIZE(rqf_name) != RQF_MAX);
 
 	seq_printf(m, "%p {.op=", rq);
 	if (strcmp(op_str, "UNKNOWN") == 0)
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index f3de4a0b5293..928674c026b3 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -27,6 +27,7 @@  typedef enum rq_end_io_ret (rq_end_io_fn)(struct request *, blk_status_t);
  * request flags */
 typedef __u32 __bitwise req_flags_t;
 
+/* Keep rqf_name[] in sync with the definitions below */
 enum {
 	/* drive already may have started this one */
 	RQF_STARTED		=	((__force req_flags_t)(1 << 0)),
@@ -60,6 +61,7 @@  enum {
 	/* ->timeout has been called, don't expire again */
 	RQF_TIMED_OUT		=	((__force req_flags_t)(1 << 14)),
 	RQF_RESV		=	((__force req_flags_t)(1 << 15)),
+	RQF_MAX			=	16
 };
 
 /* flags that prevent us from merging requests: */