]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
cxlflash: Fix read capacity timeout
authorManoj Kumar <kumarmn@us.ibm.com>
Wed, 21 Oct 2015 20:11:10 +0000 (15:11 -0500)
committerJames Bottomley <JBottomley@Odin.com>
Fri, 30 Oct 2015 07:58:09 +0000 (16:58 +0900)
The timeout value for read capacity is too small. Certain devices
may take longer to respond and thus the command may prematurely
timeout. Additionally the literal used for the timeout is stale.

Update the timeout to 30 seconds (matches the value used in sd.c)
and rework the timeout literal to a more appropriate description.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/cxlflash/superpipe.c
drivers/scsi/cxlflash/superpipe.h
drivers/scsi/cxlflash/vlun.c

index 7df985d7830c3df6e67e81f635dfd75db41decc1..c3c229ec7d0c0508c0f9486a003a34cb15a37bcc 100644 (file)
@@ -296,7 +296,7 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli)
        int rc = 0;
        int result = 0;
        int retry_cnt = 0;
-       u32 tout = (MC_DISCOVERY_TIMEOUT * HZ);
+       u32 to = CMD_TIMEOUT * HZ;
 
 retry:
        cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL);
@@ -315,8 +315,7 @@ retry:
                retry_cnt ? "re" : "", scsi_cmd[0]);
 
        result = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf,
-                             CMD_BUFSIZE, sense_buf, tout, CMD_RETRIES,
-                             0, NULL);
+                             CMD_BUFSIZE, sense_buf, to, CMD_RETRIES, 0, NULL);
 
        if (driver_byte(result) == DRIVER_SENSE) {
                result &= ~(0xFF<<24); /* DRIVER_SENSE is not an error */
@@ -1376,8 +1375,8 @@ out_attach:
        attach->block_size = gli->blk_len;
        attach->mmio_size = sizeof(afu->afu_map->hosts[0].harea);
        attach->last_lba = gli->max_lba;
-       attach->max_xfer = (sdev->host->max_sectors * MAX_SECTOR_UNIT) /
-               gli->blk_len;
+       attach->max_xfer = sdev->host->max_sectors * MAX_SECTOR_UNIT;
+       attach->max_xfer /= gli->blk_len;
 
 out:
        attach->adap_fd = fd;
index 3f7856b6642793f12d799372e46a39f25b0d5a27..fffb179a841334ac1fd39230b38ee087925ffc73 100644 (file)
@@ -28,7 +28,7 @@ extern struct cxlflash_global global;
 */
 #define MC_CHUNK_SIZE     (1 << MC_RHT_NMASK)  /* in LBAs */
 
-#define MC_DISCOVERY_TIMEOUT 5  /* 5 secs */
+#define CMD_TIMEOUT 30  /* 30 secs */
 #define CMD_RETRIES 5   /* 5 retries for scsi_execute */
 
 #define MAX_SECTOR_UNIT  512 /* max_sector is in 512 byte multiples */
index 6d6608bb4bb0880d55183fcd18452e0dfb601a67..68994c42c81f49fabe2a6a01e67feaf9fd4da522 100644 (file)
@@ -414,7 +414,7 @@ static int write_same16(struct scsi_device *sdev,
        int ws_limit = SISLITE_MAX_WS_BLOCKS;
        u64 offset = lba;
        int left = nblks;
-       u32 tout = sdev->request_queue->rq_timeout;
+       u32 to = sdev->request_queue->rq_timeout;
        struct cxlflash_cfg *cfg = (struct cxlflash_cfg *)sdev->host->hostdata;
        struct device *dev = &cfg->dev->dev;
 
@@ -434,7 +434,7 @@ static int write_same16(struct scsi_device *sdev,
                                   &scsi_cmd[10]);
 
                result = scsi_execute(sdev, scsi_cmd, DMA_TO_DEVICE, cmd_buf,
-                                     CMD_BUFSIZE, sense_buf, tout, CMD_RETRIES,
+                                     CMD_BUFSIZE, sense_buf, to, CMD_RETRIES,
                                      0, NULL);
                if (result) {
                        dev_err_ratelimited(dev, "%s: command failed for "