aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-09-14 08:55:09 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:13 -0400
commit242f9dcb8ba6f68fcd217a119a7648a4f69290e9 (patch)
tree1bfe245ffbc50d204d76665cd8f90d85100f86a1 /drivers/scsi/sd.c
parent608aeef17a91747d6303de4df5e2c2e6899a95e8 (diff)
block: unify request timeout handling
Right now SCSI and others do their own command timeout handling. Move those bits to the block layer. Instead of having a timer per command, we try to be a bit more clever and simply have one per-queue. This avoids the overhead of having to tear down and setup a timer for each command, so it will result in a lot less timer fiddling. Signed-off-by: Mike Anderson <andmike@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index cb115d1bf228..c0cf4acda7de 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -383,7 +383,6 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
383 sector_t block = rq->sector; 383 sector_t block = rq->sector;
384 sector_t threshold; 384 sector_t threshold;
385 unsigned int this_count = rq->nr_sectors; 385 unsigned int this_count = rq->nr_sectors;
386 unsigned int timeout = sdp->timeout;
387 int ret; 386 int ret;
388 387
389 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { 388 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
@@ -584,7 +583,6 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
584 SCpnt->transfersize = sdp->sector_size; 583 SCpnt->transfersize = sdp->sector_size;
585 SCpnt->underflow = this_count << 9; 584 SCpnt->underflow = this_count << 9;
586 SCpnt->allowed = SD_MAX_RETRIES; 585 SCpnt->allowed = SD_MAX_RETRIES;
587 SCpnt->timeout_per_command = timeout;
588 586
589 /* 587 /*
590 * This indicates that the command is ready from our end to be 588 * This indicates that the command is ready from our end to be
@@ -1878,11 +1876,12 @@ static int sd_probe(struct device *dev)
1878 sdkp->openers = 0; 1876 sdkp->openers = 0;
1879 sdkp->previous_state = 1; 1877 sdkp->previous_state = 1;
1880 1878
1881 if (!sdp->timeout) { 1879 if (!sdp->request_queue->rq_timeout) {
1882 if (sdp->type != TYPE_MOD) 1880 if (sdp->type != TYPE_MOD)
1883 sdp->timeout = SD_TIMEOUT; 1881 blk_queue_rq_timeout(sdp->request_queue, SD_TIMEOUT);
1884 else 1882 else
1885 sdp->timeout = SD_MOD_TIMEOUT; 1883 blk_queue_rq_timeout(sdp->request_queue,
1884 SD_MOD_TIMEOUT);
1886 } 1885 }
1887 1886
1888 device_initialize(&sdkp->dev); 1887 device_initialize(&sdkp->dev);