[SCSI] add retries field to request for REQ_BLOCK_PC use
authorMike Christie <michaelc@cs.wisc.edu>
Fri, 11 Nov 2005 11:31:37 +0000 (05:31 -0600)
committerJames Bottomley <jejb@mulgrave.(none)>
Thu, 15 Dec 2005 03:04:11 +0000 (19:04 -0800)
For tape we need to control the retries. This patch adds a retries
counter on the request for REQ_BLOCK_PC commands originating from
scsi_execute* to use. REQ_BLOCK_PC commands comming from the block
layer SG_IO path continue to use the retires set in the ULD init_command.
(scsi_execute* does not set the gendisk so we do not execute
the init_command in that path).

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/scsi_lib.c
include/linux/blkdev.h

index eb0cfbfbcf8f30daa252181de9eb6e88eeca4e67..365843a1561fa14bed6501d1e9a6fdc97ad1cb18 100644 (file)
@@ -259,6 +259,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
        memcpy(req->cmd, cmd, req->cmd_len);
        req->sense = sense;
        req->sense_len = 0;
+       req->retries = retries;
        req->timeout = timeout;
        req->flags |= flags | REQ_BLOCK_PC | REQ_SPECIAL | REQ_QUIET;
 
@@ -472,6 +473,7 @@ int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
        req->sense = sioc->sense;
        req->sense_len = 0;
        req->timeout = timeout;
+       req->retries = retries;
        req->flags |= REQ_BLOCK_PC | REQ_QUIET;
        req->end_io_data = sioc;
 
@@ -1393,7 +1395,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
                                cmd->sc_data_direction = DMA_NONE;
                        
                        cmd->transfersize = req->data_len;
-                       cmd->allowed = 3;
+                       cmd->allowed = req->retries;
                        cmd->timeout_per_command = req->timeout;
                        cmd->done = scsi_generic_done;
                }
index 9a68716dcf75fb3bdb6fe0ccf3db3b5c5b533327..509e9a03a328afe78b10a5335f289465e463e86d 100644 (file)
@@ -184,6 +184,7 @@ struct request {
        void *sense;
 
        unsigned int timeout;
+       int retries;
 
        /*
         * For Power Management requests