Skip to content

Commit ec6dcf6

Browse files
KAGA-KOKOaxboe
authored andcommitted
blk-mq-debugfs: Show more request state information
Since commit 634f9e4 ("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: 634f9e4 ("blk-mq: remove REQ_ATOM_COMPLETE usages from blk-mq") Signed-off-by: Bart Van Assche <[email protected]> Cc: Tejun Heo <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 4c69948 commit ec6dcf6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

block/blk-mq-debugfs.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,20 @@ static const char *const rqf_name[] = {
350350
};
351351
#undef RQF_NAME
352352

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+
353367
int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq)
354368
{
355369
const struct blk_mq_ops *const mq_ops = rq->q->mq_ops;
@@ -366,7 +380,7 @@ int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq)
366380
seq_puts(m, ", .rq_flags=");
367381
blk_flags_show(m, (__force unsigned int)rq->rq_flags, rqf_name,
368382
ARRAY_SIZE(rqf_name));
369-
seq_printf(m, ", complete=%d", blk_rq_is_complete(rq));
383+
seq_printf(m, ", .state=%s", blk_mq_rq_state_name(blk_mq_rq_state(rq)));
370384
seq_printf(m, ", .tag=%d, .internal_tag=%d", rq->tag,
371385
rq->internal_tag);
372386
if (mq_ops->show_rq)

0 commit comments

Comments
 (0)