block, scsi: move the retries field to struct scsi_request
Instead of bloating the generic struct request with it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
44e44b29fb
commit
64c7f1d157
|
@ -362,7 +362,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
|
||||||
goto out_free_cdb;
|
goto out_free_cdb;
|
||||||
|
|
||||||
bio = rq->bio;
|
bio = rq->bio;
|
||||||
rq->retries = 0;
|
req->retries = 0;
|
||||||
|
|
||||||
start_time = jiffies;
|
start_time = jiffies;
|
||||||
|
|
||||||
|
@ -476,13 +476,13 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* default. possible overriden later */
|
/* default. possible overriden later */
|
||||||
rq->retries = 5;
|
req->retries = 5;
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case SEND_DIAGNOSTIC:
|
case SEND_DIAGNOSTIC:
|
||||||
case FORMAT_UNIT:
|
case FORMAT_UNIT:
|
||||||
rq->timeout = FORMAT_UNIT_TIMEOUT;
|
rq->timeout = FORMAT_UNIT_TIMEOUT;
|
||||||
rq->retries = 1;
|
req->retries = 1;
|
||||||
break;
|
break;
|
||||||
case START_STOP:
|
case START_STOP:
|
||||||
rq->timeout = START_STOP_TIMEOUT;
|
rq->timeout = START_STOP_TIMEOUT;
|
||||||
|
@ -495,7 +495,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
|
||||||
break;
|
break;
|
||||||
case READ_DEFECT_DATA:
|
case READ_DEFECT_DATA:
|
||||||
rq->timeout = READ_DEFECT_DATA_TIMEOUT;
|
rq->timeout = READ_DEFECT_DATA_TIMEOUT;
|
||||||
rq->retries = 1;
|
req->retries = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
|
rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
|
||||||
|
|
|
@ -1602,7 +1602,7 @@ static int _init_blk_request(struct osd_request *or,
|
||||||
req->rq_flags |= RQF_QUIET;
|
req->rq_flags |= RQF_QUIET;
|
||||||
|
|
||||||
req->timeout = or->timeout;
|
req->timeout = or->timeout;
|
||||||
req->retries = or->retries;
|
scsi_req(req)->retries = or->retries;
|
||||||
|
|
||||||
if (has_out) {
|
if (has_out) {
|
||||||
or->out.req = req;
|
or->out.req = req;
|
||||||
|
|
|
@ -414,7 +414,7 @@ static int osst_execute(struct osst_request *SRpnt, const unsigned char *cmd,
|
||||||
memset(rq->cmd, 0, BLK_MAX_CDB); /* ATAPI hates garbage after CDB */
|
memset(rq->cmd, 0, BLK_MAX_CDB); /* ATAPI hates garbage after CDB */
|
||||||
memcpy(rq->cmd, cmd, rq->cmd_len);
|
memcpy(rq->cmd, cmd, rq->cmd_len);
|
||||||
req->timeout = timeout;
|
req->timeout = timeout;
|
||||||
req->retries = retries;
|
rq->retries = retries;
|
||||||
req->end_io_data = SRpnt;
|
req->end_io_data = SRpnt;
|
||||||
|
|
||||||
blk_execute_rq_nowait(req->q, NULL, req, 1, osst_end_async);
|
blk_execute_rq_nowait(req->q, NULL, req, 1, osst_end_async);
|
||||||
|
|
|
@ -1988,7 +1988,7 @@ static void scsi_eh_lock_door(struct scsi_device *sdev)
|
||||||
|
|
||||||
req->rq_flags |= RQF_QUIET;
|
req->rq_flags |= RQF_QUIET;
|
||||||
req->timeout = 10 * HZ;
|
req->timeout = 10 * HZ;
|
||||||
req->retries = 5;
|
rq->retries = 5;
|
||||||
|
|
||||||
blk_execute_rq_nowait(req->q, NULL, req, 1, eh_lock_door_done);
|
blk_execute_rq_nowait(req->q, NULL, req, 1, eh_lock_door_done);
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,7 +256,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
|
||||||
|
|
||||||
rq->cmd_len = COMMAND_SIZE(cmd[0]);
|
rq->cmd_len = COMMAND_SIZE(cmd[0]);
|
||||||
memcpy(rq->cmd, cmd, rq->cmd_len);
|
memcpy(rq->cmd, cmd, rq->cmd_len);
|
||||||
req->retries = retries;
|
rq->retries = retries;
|
||||||
req->timeout = timeout;
|
req->timeout = timeout;
|
||||||
req->cmd_flags |= flags;
|
req->cmd_flags |= flags;
|
||||||
req->rq_flags |= rq_flags | RQF_QUIET | RQF_PREEMPT;
|
req->rq_flags |= rq_flags | RQF_QUIET | RQF_PREEMPT;
|
||||||
|
@ -1177,7 +1177,7 @@ static int scsi_setup_scsi_cmnd(struct scsi_device *sdev, struct request *req)
|
||||||
cmd->cmd_len = scsi_req(req)->cmd_len;
|
cmd->cmd_len = scsi_req(req)->cmd_len;
|
||||||
cmd->cmnd = scsi_req(req)->cmd;
|
cmd->cmnd = scsi_req(req)->cmd;
|
||||||
cmd->transfersize = blk_rq_bytes(req);
|
cmd->transfersize = blk_rq_bytes(req);
|
||||||
cmd->allowed = req->retries;
|
cmd->allowed = scsi_req(req)->retries;
|
||||||
return BLKPREP_OK;
|
return BLKPREP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1716,7 +1716,7 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
|
||||||
|
|
||||||
srp->rq = rq;
|
srp->rq = rq;
|
||||||
rq->end_io_data = srp;
|
rq->end_io_data = srp;
|
||||||
rq->retries = SG_DEFAULT_RETRIES;
|
req->retries = SG_DEFAULT_RETRIES;
|
||||||
|
|
||||||
if ((dxfer_len <= 0) || (dxfer_dir == SG_DXFER_NONE))
|
if ((dxfer_len <= 0) || (dxfer_dir == SG_DXFER_NONE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -579,7 +579,7 @@ static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd,
|
||||||
memset(rq->cmd, 0, BLK_MAX_CDB);
|
memset(rq->cmd, 0, BLK_MAX_CDB);
|
||||||
memcpy(rq->cmd, cmd, rq->cmd_len);
|
memcpy(rq->cmd, cmd, rq->cmd_len);
|
||||||
req->timeout = timeout;
|
req->timeout = timeout;
|
||||||
req->retries = retries;
|
rq->retries = retries;
|
||||||
req->end_io_data = SRpnt;
|
req->end_io_data = SRpnt;
|
||||||
|
|
||||||
blk_execute_rq_nowait(req->q, NULL, req, 1, st_scsi_execute_end);
|
blk_execute_rq_nowait(req->q, NULL, req, 1, st_scsi_execute_end);
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ pscsi_execute_cmd(struct se_cmd *cmd)
|
||||||
req->timeout = PS_TIMEOUT_DISK;
|
req->timeout = PS_TIMEOUT_DISK;
|
||||||
else
|
else
|
||||||
req->timeout = PS_TIMEOUT_OTHER;
|
req->timeout = PS_TIMEOUT_OTHER;
|
||||||
req->retries = PS_RETRY;
|
scsi_req(req)->retries = PS_RETRY;
|
||||||
|
|
||||||
blk_execute_rq_nowait(pdv->pdv_sd->request_queue, NULL, req,
|
blk_execute_rq_nowait(pdv->pdv_sd->request_queue, NULL, req,
|
||||||
(cmd->sam_task_attr == TCM_HEAD_TAG),
|
(cmd->sam_task_attr == TCM_HEAD_TAG),
|
||||||
|
|
|
@ -224,7 +224,6 @@ struct request {
|
||||||
unsigned long deadline;
|
unsigned long deadline;
|
||||||
struct list_head timeout_list;
|
struct list_head timeout_list;
|
||||||
unsigned int timeout;
|
unsigned int timeout;
|
||||||
int retries;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* completion callback.
|
* completion callback.
|
||||||
|
|
|
@ -11,6 +11,7 @@ struct scsi_request {
|
||||||
unsigned short cmd_len;
|
unsigned short cmd_len;
|
||||||
unsigned int sense_len;
|
unsigned int sense_len;
|
||||||
unsigned int resid_len; /* residual count */
|
unsigned int resid_len; /* residual count */
|
||||||
|
int retries;
|
||||||
void *sense;
|
void *sense;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue