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:
@@ -331,7 +331,7 @@ static int sr_done(struct scsi_cmnd *SCpnt)
|
||||
|
||||
static int sr_prep_fn(struct request_queue *q, struct request *rq)
|
||||
{
|
||||
int block=0, this_count, s_size, timeout = SR_TIMEOUT;
|
||||
int block = 0, this_count, s_size;
|
||||
struct scsi_cd *cd;
|
||||
struct scsi_cmnd *SCpnt;
|
||||
struct scsi_device *sdp = q->queuedata;
|
||||
@@ -461,7 +461,6 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq)
|
||||
SCpnt->transfersize = cd->device->sector_size;
|
||||
SCpnt->underflow = this_count << 9;
|
||||
SCpnt->allowed = MAX_RETRIES;
|
||||
SCpnt->timeout_per_command = timeout;
|
||||
|
||||
/*
|
||||
* This indicates that the command is ready from our end to be
|
||||
@@ -620,6 +619,8 @@ static int sr_probe(struct device *dev)
|
||||
disk->fops = &sr_bdops;
|
||||
disk->flags = GENHD_FL_CD;
|
||||
|
||||
blk_queue_rq_timeout(sdev->request_queue, SR_TIMEOUT);
|
||||
|
||||
cd->device = sdev;
|
||||
cd->disk = disk;
|
||||
cd->driver = &sr_template;
|
||||
|
Reference in New Issue
Block a user