On 04/22/2017 01:40 AM, Bart Van Assche wrote: > Show the SCSI CDB, .eh_eflags and .result for pending SCSI commands > in /sys/kernel/debug/block/*/mq/*/dispatch and */rq_list. > > Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx> > Cc: Martin K. Petersen <martin.petersen@xxxxxxxxxx> > Cc: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> > Cc: Omar Sandoval <osandov@xxxxxx> > Cc: Hannes Reinecke <hare@xxxxxxxx> > Cc: <linux-scsi@xxxxxxxxxxxxxxx> > --- > drivers/scsi/scsi_lib.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > index 4a20e6098f7c..90bb269042df 100644 > --- a/drivers/scsi/scsi_lib.c > +++ b/drivers/scsi/scsi_lib.c > @@ -2125,6 +2125,16 @@ static void scsi_exit_rq(struct request_queue *q, struct request *rq) > scsi_free_sense_buffer(shost, cmd->sense_buffer); > } > > +static void scsi_show_rq(struct seq_file *m, struct request *rq) > +{ > + struct scsi_cmnd *cmd = container_of(scsi_req(rq), typeof(*cmd), req); > + unsigned int i; > + > + seq_puts(m, ", .cmd ="); > + for (i = 0; i < cmd->cmd_len; i++) > + seq_printf(m, " %02x", cmd->cmnd[i]); > +} > + > struct request_queue *scsi_alloc_queue(struct scsi_device *sdev) > { > struct Scsi_Host *shost = sdev->host; > @@ -2157,6 +2167,7 @@ static const struct blk_mq_ops scsi_mq_ops = { > .queue_rq = scsi_queue_rq, > .complete = scsi_softirq_done, > .timeout = scsi_timeout, > + .show_rq = scsi_show_rq, > .init_request = scsi_init_request, > .exit_request = scsi_exit_request, > .map_queues = scsi_map_queues, > Hmm. Can't say I'm happy with this callback. And I really would like to see a similar implementation for NVMe. But if others agree: Reviewed-by: Hannes Reinecke <hare@xxxxxxxx> Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage hare@xxxxxxxx +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)