aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2017-04-26 16:47:56 -0400
committerJens Axboe <axboe@fb.com>2017-04-26 17:09:04 -0400
commit2836ee4b1acbe7b396219d0677426885f14cd792 (patch)
tree823c705f789aaa2eb68d9c32913b686c55ea60a7
parent8658dca8bd5666f50e02400f844079e520641d8c (diff)
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 <bart.vanassche@sandisk.com> Reviewed-by: Omar Sandoval <osandov@fb.com> Cc: Hannes Reinecke <hare@suse.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--block/blk-mq-debugfs.c6
-rw-r--r--include/linux/blk-mq.h8
2 files changed, 13 insertions, 1 deletions
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index ac39093c4ef7..bcd2a7d4a3a5 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -311,6 +311,7 @@ static const char *const rqf_name[] = {
311static int blk_mq_debugfs_rq_show(struct seq_file *m, void *v) 311static int blk_mq_debugfs_rq_show(struct seq_file *m, void *v)
312{ 312{
313 struct request *rq = list_entry_rq(v); 313 struct request *rq = list_entry_rq(v);
314 const struct blk_mq_ops *const mq_ops = rq->q->mq_ops;
314 const unsigned int op = rq->cmd_flags & REQ_OP_MASK; 315 const unsigned int op = rq->cmd_flags & REQ_OP_MASK;
315 316
316 seq_printf(m, "%p {.op=", rq); 317 seq_printf(m, "%p {.op=", rq);
@@ -324,8 +325,11 @@ static int blk_mq_debugfs_rq_show(struct seq_file *m, void *v)
324 seq_puts(m, ", .rq_flags="); 325 seq_puts(m, ", .rq_flags=");
325 blk_flags_show(m, (__force unsigned int)rq->rq_flags, rqf_name, 326 blk_flags_show(m, (__force unsigned int)rq->rq_flags, rqf_name,
326 ARRAY_SIZE(rqf_name)); 327 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,
328 rq->internal_tag); 329 rq->internal_tag);
330 if (mq_ops->show_rq)
331 mq_ops->show_rq(m, rq);
332 seq_puts(m, "}\n");
329 return 0; 333 return 0;
330} 334}
331 335
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 0c4dadb85f62..32bd8eb5ba67 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -142,6 +142,14 @@ struct blk_mq_ops {
142 reinit_request_fn *reinit_request; 142 reinit_request_fn *reinit_request;
143 143
144 map_queues_fn *map_queues; 144 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
145}; 153};
146 154
147enum { 155enum {