block, scsi: move the retries field to struct scsi_request
authorChristoph Hellwig <hch@lst.de>
Wed, 5 Apr 2017 17:18:12 +0000 (19:18 +0200)
committerJens Axboe <axboe@fb.com>
Wed, 5 Apr 2017 18:05:08 +0000 (12:05 -0600)
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>
block/scsi_ioctl.c
drivers/scsi/osd/osd_initiator.c
drivers/scsi/osst.c
drivers/scsi/scsi_error.c
drivers/scsi/scsi_lib.c
drivers/scsi/sg.c
drivers/scsi/st.c
drivers/target/target_core_pscsi.c
include/linux/blkdev.h
include/scsi/scsi_request.h

index 2a2fc768b27ad81583424252f13b89303269b755..82a43bb199671e4b53f2b607d86fb5d6d8ae669e 100644 (file)
@@ -362,7 +362,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
                goto out_free_cdb;
 
        bio = rq->bio;
-       rq->retries = 0;
+       req->retries = 0;
 
        start_time = jiffies;
 
@@ -476,13 +476,13 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
                goto error;
 
        /* default.  possible overriden later */
-       rq->retries = 5;
+       req->retries = 5;
 
        switch (opcode) {
        case SEND_DIAGNOSTIC:
        case FORMAT_UNIT:
                rq->timeout = FORMAT_UNIT_TIMEOUT;
-               rq->retries = 1;
+               req->retries = 1;
                break;
        case START_STOP:
                rq->timeout = START_STOP_TIMEOUT;
@@ -495,7 +495,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
                break;
        case READ_DEFECT_DATA:
                rq->timeout = READ_DEFECT_DATA_TIMEOUT;
-               rq->retries = 1;
+               req->retries = 1;
                break;
        default:
                rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
index 6903f03c88af46bb54f7d3bb1e07b3a16596714d..9d0727b2bdec7cab822de20f3c383257af10c9a7 100644 (file)
@@ -1602,7 +1602,7 @@ static int _init_blk_request(struct osd_request *or,
        req->rq_flags |= RQF_QUIET;
 
        req->timeout = or->timeout;
-       req->retries = or->retries;
+       scsi_req(req)->retries = or->retries;
 
        if (has_out) {
                or->out.req = req;
index c47f4b349bac44dcaaa88ffefdb4257cc51ccee3..41bc1d64bf865ee1cf4a31d7419e902dff7242ab 100644 (file)
@@ -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 */
        memcpy(rq->cmd, cmd, rq->cmd_len);
        req->timeout = timeout;
-       req->retries = retries;
+       rq->retries = retries;
        req->end_io_data = SRpnt;
 
        blk_execute_rq_nowait(req->q, NULL, req, 1, osst_end_async);
index f2cafae150bcdb85292d86945cfb9d6e9fd7c340..2db412dd4b4477f973d25d24f543fb0601f2ba2a 100644 (file)
@@ -1988,7 +1988,7 @@ static void scsi_eh_lock_door(struct scsi_device *sdev)
 
        req->rq_flags |= RQF_QUIET;
        req->timeout = 10 * HZ;
-       req->retries = 5;
+       rq->retries = 5;
 
        blk_execute_rq_nowait(req->q, NULL, req, 1, eh_lock_door_done);
 }
index c1519660824b63d6e8cd428fea3786992f021f3c..11972d1075f127ed1884ca5b88e1264b408e2a36 100644 (file)
@@ -256,7 +256,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
 
        rq->cmd_len = COMMAND_SIZE(cmd[0]);
        memcpy(rq->cmd, cmd, rq->cmd_len);
-       req->retries = retries;
+       rq->retries = retries;
        req->timeout = timeout;
        req->cmd_flags |= flags;
        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->cmnd = scsi_req(req)->cmd;
        cmd->transfersize = blk_rq_bytes(req);
-       cmd->allowed = req->retries;
+       cmd->allowed = scsi_req(req)->retries;
        return BLKPREP_OK;
 }
 
index 29b86505f796d9fa57c19b958c1c7ae4ef31b298..b61cc3c512d3df5ec64b29fa6284cfd8ae09006b 100644 (file)
@@ -1716,7 +1716,7 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
 
        srp->rq = rq;
        rq->end_io_data = srp;
-       rq->retries = SG_DEFAULT_RETRIES;
+       req->retries = SG_DEFAULT_RETRIES;
 
        if ((dxfer_len <= 0) || (dxfer_dir == SG_DXFER_NONE))
                return 0;
index e5ef78a6848ef11f0eee8e9c462f5d8daecd59dc..5408643431bba7a1a5b0f8c4650d09eab3f121dd 100644 (file)
@@ -579,7 +579,7 @@ static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd,
        memset(rq->cmd, 0, BLK_MAX_CDB);
        memcpy(rq->cmd, cmd, rq->cmd_len);
        req->timeout = timeout;
-       req->retries = retries;
+       rq->retries = retries;
        req->end_io_data = SRpnt;
 
        blk_execute_rq_nowait(req->q, NULL, req, 1, st_scsi_execute_end);
index 94cda7991e80abbffb32941c8d8f5cfcbd262e3f..c7fa372c527a78f05afcb20b7f3bbef3c6f61d12 100644 (file)
@@ -1008,7 +1008,7 @@ pscsi_execute_cmd(struct se_cmd *cmd)
                req->timeout = PS_TIMEOUT_DISK;
        else
                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,
                        (cmd->sam_task_attr == TCM_HEAD_TAG),
index a2dc6b390d4839e224553333822c4c37ae64a5bd..ce6f9a6534c937062648e6fd7db90510e2a26f0a 100644 (file)
@@ -224,7 +224,6 @@ struct request {
        unsigned long deadline;
        struct list_head timeout_list;
        unsigned int timeout;
-       int retries;
 
        /*
         * completion callback.
index ba0aeb980f7e7cb654171697316f6089b9db01d0..7c583a0f363a8f5f2a6929d6407312ca67ef2fbc 100644 (file)
@@ -11,6 +11,7 @@ struct scsi_request {
        unsigned short  cmd_len;
        unsigned int    sense_len;
        unsigned int    resid_len;      /* residual count */
+       int             retries;
        void            *sense;
 };