diff options
author | James Bottomley <jbottomley@parallels.com> | 2013-10-04 17:42:24 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-10-25 04:58:16 -0400 |
commit | 7e660100d85af860e7ad763202fff717adcdaacd (patch) | |
tree | 851008ff72523b38313ddc4609001904e7d400d9 /drivers/scsi/sd.c | |
parent | d078b5117f18dce57b895df640d9bf2614864829 (diff) |
[SCSI] Derive the FLUSH_TIMEOUT from the basic I/O timeout
Rather than having a separate constant for specifying the timeout on FLUSH
operations, use the basic I/O timeout value that is already configurable
on a per target basis to derive the FLUSH timeout. Looking at the current
definitions of these timeout values, the FLUSH operation is supposed to have
a value that is twice the normal timeout value. This patch preserves this
relationship while leveraging the flexibility of specifying the I/O timeout.
Based on a prior patch by KY Srinivasan <kys@microsoft.com>
Reviewed-by: KY Srinivasan <kys@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3824e754ca1d..fd874b846dc1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -830,7 +830,7 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq) | |||
830 | 830 | ||
831 | static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq) | 831 | static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq) |
832 | { | 832 | { |
833 | rq->timeout = SD_FLUSH_TIMEOUT; | 833 | rq->timeout *= SD_FLUSH_TIMEOUT_MULTIPLIER; |
834 | rq->retries = SD_MAX_RETRIES; | 834 | rq->retries = SD_MAX_RETRIES; |
835 | rq->cmd[0] = SYNCHRONIZE_CACHE; | 835 | rq->cmd[0] = SYNCHRONIZE_CACHE; |
836 | rq->cmd_len = 10; | 836 | rq->cmd_len = 10; |
@@ -1434,6 +1434,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp) | |||
1434 | { | 1434 | { |
1435 | int retries, res; | 1435 | int retries, res; |
1436 | struct scsi_device *sdp = sdkp->device; | 1436 | struct scsi_device *sdp = sdkp->device; |
1437 | const int timeout = sdp->request_queue->rq_timeout | ||
1438 | * SD_FLUSH_TIMEOUT_MULTIPLIER; | ||
1437 | struct scsi_sense_hdr sshdr; | 1439 | struct scsi_sense_hdr sshdr; |
1438 | 1440 | ||
1439 | if (!scsi_device_online(sdp)) | 1441 | if (!scsi_device_online(sdp)) |
@@ -1448,8 +1450,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp) | |||
1448 | * flush everything. | 1450 | * flush everything. |
1449 | */ | 1451 | */ |
1450 | res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0, | 1452 | res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0, |
1451 | &sshdr, SD_FLUSH_TIMEOUT, | 1453 | &sshdr, timeout, SD_MAX_RETRIES, |
1452 | SD_MAX_RETRIES, NULL, REQ_PM); | 1454 | NULL, REQ_PM); |
1453 | if (res == 0) | 1455 | if (res == 0) |
1454 | break; | 1456 | break; |
1455 | } | 1457 | } |