diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2008-09-14 08:55:09 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-10-09 02:56:13 -0400 |
commit | 242f9dcb8ba6f68fcd217a119a7648a4f69290e9 (patch) | |
tree | 1bfe245ffbc50d204d76665cd8f90d85100f86a1 /drivers/scsi/scsi_sysfs.c | |
parent | 608aeef17a91747d6303de4df5e2c2e6899a95e8 (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/scsi_sysfs.c')
-rw-r--r-- | drivers/scsi/scsi_sysfs.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index ab3c71869be5..7f618ee5ecea 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -560,12 +560,15 @@ sdev_rd_attr (vendor, "%.8s\n"); | |||
560 | sdev_rd_attr (model, "%.16s\n"); | 560 | sdev_rd_attr (model, "%.16s\n"); |
561 | sdev_rd_attr (rev, "%.4s\n"); | 561 | sdev_rd_attr (rev, "%.4s\n"); |
562 | 562 | ||
563 | /* | ||
564 | * TODO: can we make these symlinks to the block layer ones? | ||
565 | */ | ||
563 | static ssize_t | 566 | static ssize_t |
564 | sdev_show_timeout (struct device *dev, struct device_attribute *attr, char *buf) | 567 | sdev_show_timeout (struct device *dev, struct device_attribute *attr, char *buf) |
565 | { | 568 | { |
566 | struct scsi_device *sdev; | 569 | struct scsi_device *sdev; |
567 | sdev = to_scsi_device(dev); | 570 | sdev = to_scsi_device(dev); |
568 | return snprintf (buf, 20, "%d\n", sdev->timeout / HZ); | 571 | return snprintf(buf, 20, "%d\n", sdev->request_queue->rq_timeout / HZ); |
569 | } | 572 | } |
570 | 573 | ||
571 | static ssize_t | 574 | static ssize_t |
@@ -576,7 +579,7 @@ sdev_store_timeout (struct device *dev, struct device_attribute *attr, | |||
576 | int timeout; | 579 | int timeout; |
577 | sdev = to_scsi_device(dev); | 580 | sdev = to_scsi_device(dev); |
578 | sscanf (buf, "%d\n", &timeout); | 581 | sscanf (buf, "%d\n", &timeout); |
579 | sdev->timeout = timeout * HZ; | 582 | blk_queue_rq_timeout(sdev->request_queue, timeout * HZ); |
580 | return count; | 583 | return count; |
581 | } | 584 | } |
582 | static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout); | 585 | static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout); |