void scsi_show_rq(struct seq_file *m, struct request *rq)
{
- struct scsi_cmnd *cmd = container_of(scsi_req(rq), typeof(*cmd), req);
+ struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq);
int alloc_ms = jiffies_to_msecs(jiffies - cmd->jiffies_at_alloc);
int timeout_ms = jiffies_to_msecs(rq->timeout);
char buf[80] = "(?)";
{
struct scsi_cmnd *scmd;
struct request *req;
- struct scsi_request *rq;
req = scsi_alloc_request(sdev->request_queue, REQ_OP_DRV_IN, 0);
if (IS_ERR(req))
return;
- rq = scsi_req(req);
scmd = blk_mq_rq_to_pdu(req);
scmd->cmnd[0] = ALLOW_MEDIUM_REMOVAL;
req->rq_flags |= RQF_QUIET;
req->timeout = 10 * HZ;
- rq->retries = 5;
+ scmd->allowed = 5;
blk_execute_rq_nowait(req, true, eh_lock_door_done);
}
int writing = 0;
int at_head = 0;
struct request *rq;
- struct scsi_request *req;
struct scsi_cmnd *scmd;
struct bio *bio;
REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 0);
if (IS_ERR(rq))
return PTR_ERR(rq);
- req = scsi_req(rq);
scmd = blk_mq_rq_to_pdu(rq);
if (hdr->cmd_len > sizeof(scmd->cmnd)) {
goto out_put_request;
bio = rq->bio;
- req->retries = 0;
+ scmd->allowed = 0;
start_time = jiffies;
struct scsi_ioctl_command __user *sic)
{
struct request *rq;
- struct scsi_request *req;
int err;
unsigned int in_len, out_len, bytes, opcode, cmdlen;
struct scsi_cmnd *scmd;
err = PTR_ERR(rq);
goto error_free_buffer;
}
- req = scsi_req(rq);
scmd = blk_mq_rq_to_pdu(rq);
cmdlen = COMMAND_SIZE(opcode);
goto error;
/* default. possible overridden later */
- req->retries = 5;
+ scmd->allowed = 5;
switch (opcode) {
case SEND_DIAGNOSTIC:
case FORMAT_UNIT:
rq->timeout = FORMAT_UNIT_TIMEOUT;
- req->retries = 1;
+ scmd->allowed = 1;
break;
case START_STOP:
rq->timeout = START_STOP_TIMEOUT;
break;
case READ_DEFECT_DATA:
rq->timeout = READ_DEFECT_DATA_TIMEOUT;
- req->retries = 1;
+ scmd->allowed = 1;
break;
default:
rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
int *resid)
{
struct request *req;
- struct scsi_request *rq;
struct scsi_cmnd *scmd;
int ret;
if (IS_ERR(req))
return PTR_ERR(req);
- rq = scsi_req(req);
-
if (bufflen) {
ret = blk_rq_map_kern(sdev->request_queue, req,
buffer, bufflen, GFP_NOIO);
scmd = blk_mq_rq_to_pdu(req);
scmd->cmd_len = COMMAND_SIZE(cmd[0]);
memcpy(scmd->cmnd, cmd, scmd->cmd_len);
- rq->retries = retries;
+ scmd->allowed = retries;
req->timeout = timeout;
req->cmd_flags |= flags;
req->rq_flags |= rq_flags | RQF_QUIET;
}
cmd->transfersize = blk_rq_bytes(req);
- cmd->allowed = scsi_req(req)->retries;
return BLK_STS_OK;
}
{
int res;
struct request *rq;
- struct scsi_request *req;
Sg_fd *sfp = srp->parentfp;
sg_io_hdr_t *hp = &srp->header;
int dxfer_len = (int) hp->dxfer_len;
if (IS_ERR(rq))
return PTR_ERR(rq);
scmd = blk_mq_rq_to_pdu(rq);
- req = scsi_req(rq);
if (hp->cmd_len > sizeof(scmd->cmnd)) {
blk_mq_free_request(rq);
srp->rq = rq;
rq->end_io_data = srp;
- req->retries = SG_DEFAULT_RETRIES;
+ scmd->allowed = SG_DEFAULT_RETRIES;
if ((dxfer_len <= 0) || (dxfer_dir == SG_DXFER_NONE))
return 0;
{
struct gendisk *disk = cdi->disk;
u32 len = nr * CD_FRAMESIZE_RAW;
- struct scsi_request *req;
struct scsi_cmnd *scmd;
struct request *rq;
struct bio *bio;
rq = scsi_alloc_request(disk->queue, REQ_OP_DRV_IN, 0);
if (IS_ERR(rq))
return PTR_ERR(rq);
- req = scsi_req(rq);
scmd = blk_mq_rq_to_pdu(rq);
ret = blk_rq_map_user(disk->queue, rq, NULL, ubuf, len, GFP_KERNEL);
int timeout, int retries)
{
struct request *req;
- struct scsi_request *rq;
struct rq_map_data *mdata = &SRpnt->stp->buffer->map_data;
int err = 0;
struct scsi_tape *STp = SRpnt->stp;
if (IS_ERR(req))
return PTR_ERR(req);
scmd = blk_mq_rq_to_pdu(req);
- rq = scsi_req(req);
req->rq_flags |= RQF_QUIET;
mdata->null_mapped = 1;
scmd->cmd_len = COMMAND_SIZE(cmd[0]);
memcpy(scmd->cmnd, cmd, scmd->cmd_len);
req->timeout = timeout;
- rq->retries = retries;
+ scmd->allowed = retries;
req->end_io_data = SRpnt;
blk_execute_rq_nowait(req, true, st_scsi_execute_end);
req->timeout = PS_TIMEOUT_DISK;
else
req->timeout = PS_TIMEOUT_OTHER;
- scsi_req(req)->retries = PS_RETRY;
+ scmd->allowed = PS_RETRY;
cmd->priv = scmd->cmnd;
} __packed;
struct scsi_cmnd {
- struct scsi_request req;
struct scsi_device *device;
struct list_head eh_entry; /* entry for the host eh_abort_list/eh_cmd_q */
struct delayed_work abort_work;
#include <linux/blk-mq.h>
-struct scsi_request {
- int retries;
-};
-
-static inline struct scsi_request *scsi_req(struct request *rq)
-{
- return blk_mq_rq_to_pdu(rq);
-}
-
#endif /* _SCSI_SCSI_REQUEST_H */