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>
This commit is contained in:
@@ -383,7 +383,6 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
|
||||
sector_t block = rq->sector;
|
||||
sector_t threshold;
|
||||
unsigned int this_count = rq->nr_sectors;
|
||||
unsigned int timeout = sdp->timeout;
|
||||
int ret;
|
||||
|
||||
if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
|
||||
@@ -584,7 +583,6 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
|
||||
SCpnt->transfersize = sdp->sector_size;
|
||||
SCpnt->underflow = this_count << 9;
|
||||
SCpnt->allowed = SD_MAX_RETRIES;
|
||||
SCpnt->timeout_per_command = timeout;
|
||||
|
||||
/*
|
||||
* This indicates that the command is ready from our end to be
|
||||
@@ -1878,11 +1876,12 @@ static int sd_probe(struct device *dev)
|
||||
sdkp->openers = 0;
|
||||
sdkp->previous_state = 1;
|
||||
|
||||
if (!sdp->timeout) {
|
||||
if (!sdp->request_queue->rq_timeout) {
|
||||
if (sdp->type != TYPE_MOD)
|
||||
sdp->timeout = SD_TIMEOUT;
|
||||
blk_queue_rq_timeout(sdp->request_queue, SD_TIMEOUT);
|
||||
else
|
||||
sdp->timeout = SD_MOD_TIMEOUT;
|
||||
blk_queue_rq_timeout(sdp->request_queue,
|
||||
SD_MOD_TIMEOUT);
|
||||
}
|
||||
|
||||
device_initialize(&sdkp->dev);
|
||||
|
Reference in New Issue
Block a user