1

block: Catch possible entries missing from rqf_name[]

Add a BUILD_BUG_ON() call to ensure that we are not missing entries in
rqf_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-16-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
John Garry 2024-07-19 11:29:12 +00:00 committed by Jens Axboe
parent 2d61a6c2ca
commit 8a47e33f50
2 changed files with 2 additions and 0 deletions

View File

@ -282,6 +282,7 @@ int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq)
const char *op_str = blk_op_str(op); const char *op_str = blk_op_str(op);
BUILD_BUG_ON(ARRAY_SIZE(cmd_flag_name) != __REQ_NR_BITS); BUILD_BUG_ON(ARRAY_SIZE(cmd_flag_name) != __REQ_NR_BITS);
BUILD_BUG_ON(ARRAY_SIZE(rqf_name) != __RQF_BITS);
seq_printf(m, "%p {.op=", rq); seq_printf(m, "%p {.op=", rq);
if (strcmp(op_str, "UNKNOWN") == 0) if (strcmp(op_str, "UNKNOWN") == 0)

View File

@ -27,6 +27,7 @@ typedef enum rq_end_io_ret (rq_end_io_fn)(struct request *, blk_status_t);
* request flags */ * request flags */
typedef __u32 __bitwise req_flags_t; typedef __u32 __bitwise req_flags_t;
/* Keep rqf_name[] in sync with the definitions below */
enum { enum {
/* drive already may have started this one */ /* drive already may have started this one */
__RQF_STARTED, __RQF_STARTED,