Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Bart Van Assche | 0eebd00 | 2017-04-26 13:47:57 -0700 | [diff] [blame] | 2 | #include <linux/seq_file.h> |
| 3 | #include <scsi/scsi_cmnd.h> |
| 4 | #include <scsi/scsi_dbg.h> |
| 5 | #include "scsi_debugfs.h" |
| 6 | |
| 7 | void scsi_show_rq(struct seq_file *m, struct request *rq) |
| 8 | { |
| 9 | struct scsi_cmnd *cmd = container_of(scsi_req(rq), typeof(*cmd), req); |
Bart Van Assche | cad8cf2 | 2017-08-30 16:58:41 -0700 | [diff] [blame] | 10 | int msecs = jiffies_to_msecs(jiffies - cmd->jiffies_at_alloc); |
Bart Van Assche | 14e3062 | 2017-12-05 16:57:51 -0800 | [diff] [blame^] | 11 | const u8 *const cdb = READ_ONCE(cmd->cmnd); |
| 12 | char buf[80] = "(?)"; |
Bart Van Assche | 0eebd00 | 2017-04-26 13:47:57 -0700 | [diff] [blame] | 13 | |
Bart Van Assche | 14e3062 | 2017-12-05 16:57:51 -0800 | [diff] [blame^] | 14 | if (cdb) |
| 15 | __scsi_format_command(buf, sizeof(buf), cdb, cmd->cmd_len); |
Bart Van Assche | cad8cf2 | 2017-08-30 16:58:41 -0700 | [diff] [blame] | 16 | seq_printf(m, ", .cmd=%s, .retries=%d, allocated %d.%03d s ago", buf, |
| 17 | cmd->retries, msecs / 1000, msecs % 1000); |
Bart Van Assche | 0eebd00 | 2017-04-26 13:47:57 -0700 | [diff] [blame] | 18 | } |