Skip to content

Commit 2836ee4

Browse files
Bart Van Asscheaxboe
authored andcommitted
blk-mq: Add blk_mq_ops.show_rq()
This new callback function will be used in the next patch to show more information about SCSI requests. Signed-off-by: Bart Van Assche <[email protected]> Reviewed-by: Omar Sandoval <[email protected]> Cc: Hannes Reinecke <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 8658dca commit 2836ee4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

block/blk-mq-debugfs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ static const char *const rqf_name[] = {
311311
static int blk_mq_debugfs_rq_show(struct seq_file *m, void *v)
312312
{
313313
struct request *rq = list_entry_rq(v);
314+
const struct blk_mq_ops *const mq_ops = rq->q->mq_ops;
314315
const unsigned int op = rq->cmd_flags & REQ_OP_MASK;
315316

316317
seq_printf(m, "%p {.op=", rq);
@@ -324,8 +325,11 @@ static int blk_mq_debugfs_rq_show(struct seq_file *m, void *v)
324325
seq_puts(m, ", .rq_flags=");
325326
blk_flags_show(m, (__force unsigned int)rq->rq_flags, rqf_name,
326327
ARRAY_SIZE(rqf_name));
327-
seq_printf(m, ", .tag=%d, .internal_tag=%d}\n", rq->tag,
328+
seq_printf(m, ", .tag=%d, .internal_tag=%d", rq->tag,
328329
rq->internal_tag);
330+
if (mq_ops->show_rq)
331+
mq_ops->show_rq(m, rq);
332+
seq_puts(m, "}\n");
329333
return 0;
330334
}
331335

include/linux/blk-mq.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ struct blk_mq_ops {
142142
reinit_request_fn *reinit_request;
143143

144144
map_queues_fn *map_queues;
145+
146+
#ifdef CONFIG_BLK_DEBUG_FS
147+
/*
148+
* Used by the debugfs implementation to show driver-specific
149+
* information about a request.
150+
*/
151+
void (*show_rq)(struct seq_file *m, struct request *rq);
152+
#endif
145153
};
146154

147155
enum {

0 commit comments

Comments
 (0)