public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Allow LLDs to modify disk r/w timeout
@ 2004-04-01  4:25 Brian King
  0 siblings, 0 replies; only message in thread
From: Brian King @ 2004-04-01  4:25 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: Type: text/plain, Size: 465 bytes --]

Attached is a patch that adds a rw_timeout field to the scsi_device 
struct which LLDs can setup in their slave_configure routines to 
override the read/write timeout used by sd. Various disk device types 
(i.e. RAID array devices) need longer timeout values than regular scsi 
disks, and this patch allows for this. This would get remove one of the 
reasons the ipr driver modifies the scsi timer today.

Brian King
eServer Storage I/O
IBM Linux Technology Center

[-- Attachment #2: sd_timeout_mod.patch --]
[-- Type: text/plain, Size: 1881 bytes --]


This patch adds a r/w timeout field to the scsi_device struct
to allow LLDs to modify the r/w timeout used by the scsi disk
driver. LLDs may setup this field in their slave_configure
routines if they require a different timeout to be used for
certain devices, such as RAID arrays.


---

 linux-2.6.5-rc3-bjking1/drivers/scsi/sd.c          |   11 ++++++++---
 linux-2.6.5-rc3-bjking1/include/scsi/scsi_device.h |    2 ++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff -puN drivers/scsi/sd.c~sd_timeout_mod drivers/scsi/sd.c
--- linux-2.6.5-rc3/drivers/scsi/sd.c~sd_timeout_mod	2004-03-31 19:55:51.000000000 -0600
+++ linux-2.6.5-rc3-bjking1/drivers/scsi/sd.c	2004-03-31 21:41:31.000000000 -0600
@@ -203,9 +203,7 @@ static int sd_init_command(struct scsi_c
 	sector_t block;
 	struct scsi_device *sdp = SCpnt->device;
 
-	timeout = SD_TIMEOUT;
-	if (SCpnt->device->type != TYPE_DISK)
-		timeout = SD_MOD_TIMEOUT;
+	timeout = sdp->rw_timeout;
 
 	/*
 	 * these are already setup, just copy cdb basically
@@ -1370,6 +1368,13 @@ static int sd_probe(struct device *dev)
 	sdkp->index = index;
 	sdkp->openers = 0;
 
+	if (!sdp->rw_timeout) {
+		if (sdp->type == TYPE_DISK)
+			sdp->rw_timeout = SD_TIMEOUT;
+		else
+			sdp->rw_timeout = SD_MOD_TIMEOUT;
+	}
+
 	devno = make_sd_dev(index, 0);
 	gd->major = MAJOR(devno);
 	gd->first_minor = MINOR(devno);
diff -puN include/scsi/scsi_device.h~sd_timeout_mod include/scsi/scsi_device.h
--- linux-2.6.5-rc3/include/scsi/scsi_device.h~sd_timeout_mod	2004-03-31 20:08:26.000000000 -0600
+++ linux-2.6.5-rc3-bjking1/include/scsi/scsi_device.h	2004-03-31 20:10:20.000000000 -0600
@@ -104,6 +104,8 @@ struct scsi_device {
 	unsigned int max_device_blocked; /* what device_blocked counts down from  */
 #define SCSI_DEFAULT_DEVICE_BLOCKED	3
 
+	int rw_timeout;
+
 	struct device		sdev_gendev;
 	struct class_device	sdev_classdev;
 

_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-04-01  4:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-01  4:25 [PATCH] Allow LLDs to modify disk r/w timeout Brian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox