Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

blk-mq-debugfs: Show more request state information

Since commit 634f9e4631a8 ("blk-mq: remove REQ_ATOM_COMPLETE usages
from blk-mq") blk_rq_is_complete() only reports whether or not a
request has completed for legacy queues. Hence modify the
blk-mq-debugfs code such that it shows the blk-mq request state
again.

Fixes: 634f9e4631a8 ("blk-mq: remove REQ_ATOM_COMPLETE usages from blk-mq")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Bart Van Assche and committed by
Jens Axboe
ec6dcf63 4c699480

+15 -1
+15 -1
block/blk-mq-debugfs.c
··· 350 350 }; 351 351 #undef RQF_NAME 352 352 353 + static const char *const blk_mq_rq_state_name_array[] = { 354 + [MQ_RQ_IDLE] = "idle", 355 + [MQ_RQ_IN_FLIGHT] = "in_flight", 356 + [MQ_RQ_COMPLETE] = "complete", 357 + }; 358 + 359 + static const char *blk_mq_rq_state_name(enum mq_rq_state rq_state) 360 + { 361 + if (WARN_ON_ONCE((unsigned int)rq_state > 362 + ARRAY_SIZE(blk_mq_rq_state_name_array))) 363 + return "(?)"; 364 + return blk_mq_rq_state_name_array[rq_state]; 365 + } 366 + 353 367 int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq) 354 368 { 355 369 const struct blk_mq_ops *const mq_ops = rq->q->mq_ops; ··· 380 366 seq_puts(m, ", .rq_flags="); 381 367 blk_flags_show(m, (__force unsigned int)rq->rq_flags, rqf_name, 382 368 ARRAY_SIZE(rqf_name)); 383 - seq_printf(m, ", complete=%d", blk_rq_is_complete(rq)); 369 + seq_printf(m, ", .state=%s", blk_mq_rq_state_name(blk_mq_rq_state(rq))); 384 370 seq_printf(m, ", .tag=%d, .internal_tag=%d", rq->tag, 385 371 rq->internal_tag); 386 372 if (mq_ops->show_rq)