summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_debugfs.c
blob: 01f08c03f2c185dc3f7e1d423c3459da95fb6cbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// SPDX-License-Identifier: GPL-2.0
#include <linux/seq_file.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_dbg.h>
#include "scsi_debugfs.h"

void scsi_show_rq(struct seq_file *m, struct request *rq)
{
	struct scsi_cmnd *cmd = container_of(scsi_req(rq), typeof(*cmd), req);
	int msecs = jiffies_to_msecs(jiffies - cmd->jiffies_at_alloc);
	char buf[80];

	__scsi_format_command(buf, sizeof(buf), cmd->cmnd, cmd->cmd_len);
	seq_printf(m, ", .cmd=%s, .retries=%d, allocated %d.%03d s ago", buf,
		   cmd->retries, msecs / 1000, msecs % 1000);
}