public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian King <brking@us.ibm.com>
To: Brian King <brking@us.ibm.com>
Cc: "Smart, James" <James.Smart@Emulex.com>,
	'James Bottomley' <James.Bottomley@SteelEye.com>,
	Linux SCSI Reflector <linux-scsi@vger.kernel.org>
Subject: [PATCH] scsi_timeout_mod
Date: Mon, 03 May 2004 10:47:55 -0500	[thread overview]
Message-ID: <409669AB.7030207@us.ibm.com> (raw)
In-Reply-To: 40883CF6.8050808@us.ibm.com

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

The following patch replaces the sd_timeout_mod patch I submitted earlier.
I renamed the field to simply "timeout" and exposed in in sysfs.




-- 
Brian King
eServer Storage I/O
IBM Linux Technology Center

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


This patch allows LLDs to override the default timeout used for scsi devices
and exposes it in sysfs. The default timeout value used is too short for
many RAID array devices, such as those created by the ipr driver.


---


diff -puN include/scsi/scsi_device.h~scsi_timeout_mod include/scsi/scsi_device.h
--- linux-2.6.6-rc3/include/scsi/scsi_device.h~scsi_timeout_mod	Fri Apr 30 09:51:49 2004
+++ linux-2.6.6-rc3-bjking1/include/scsi/scsi_device.h	Fri Apr 30 09:52:16 2004
@@ -111,6 +111,8 @@ struct scsi_device {
 	unsigned int max_device_blocked; /* what device_blocked counts down from  */
 #define SCSI_DEFAULT_DEVICE_BLOCKED	3
 
+	int timeout;
+
 	struct device		sdev_gendev;
 	struct class_device	sdev_classdev;
 
diff -puN drivers/scsi/scsi_sysfs.c~scsi_timeout_mod drivers/scsi/scsi_sysfs.c
--- linux-2.6.6-rc3/drivers/scsi/scsi_sysfs.c~scsi_timeout_mod	Fri Apr 30 09:52:43 2004
+++ linux-2.6.6-rc3-bjking1/drivers/scsi/scsi_sysfs.c	Fri Apr 30 09:53:56 2004
@@ -302,6 +302,26 @@ sdev_rd_attr (model, "%.16s\n");
 sdev_rd_attr (rev, "%.4s\n");
 
 static ssize_t
+sdev_show_timeout (struct device *dev, char *buf)
+{
+	struct scsi_device *sdev;
+	sdev = to_scsi_device(dev);
+	return snprintf (buf, 20, "%d\n", sdev->timeout / HZ);
+}
+
+static ssize_t
+sdev_store_timeout (struct device *dev, const char *buf, size_t count)
+{
+	struct scsi_device *sdev;
+	int timeout;
+	sdev = to_scsi_device(dev);
+	sscanf (buf, "%d\n", &timeout);
+	sdev->timeout = timeout * HZ;
+	return count;
+}
+static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout)
+
+static ssize_t
 store_rescan_field (struct device *dev, const char *buf, size_t count) 
 {
 	scsi_rescan_device(dev);
@@ -367,6 +387,7 @@ static struct device_attribute *scsi_sys
 	&dev_attr_rescan,
 	&dev_attr_delete,
 	&dev_attr_state,
+	&dev_attr_timeout,
 	NULL
 };
 
diff -puN drivers/scsi/sd.c~scsi_timeout_mod drivers/scsi/sd.c
--- linux-2.6.6-rc3/drivers/scsi/sd.c~scsi_timeout_mod	Fri Apr 30 09:54:04 2004
+++ linux-2.6.6-rc3-bjking1/drivers/scsi/sd.c	Fri Apr 30 09:55:42 2004
@@ -207,9 +207,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->timeout;
 
 	/*
 	 * these are already setup, just copy cdb basically
@@ -1382,6 +1380,13 @@ static int sd_probe(struct device *dev)
 	sdkp->index = index;
 	sdkp->openers = 0;
 
+	if (!sdp->timeout) {
+		if (sdp->type == TYPE_DISK)
+			sdp->timeout = SD_TIMEOUT;
+		else
+			sdp->timeout = SD_MOD_TIMEOUT;
+	}
+
 	devno = make_sd_dev(index, 0);
 	gd->major = MAJOR(devno);
 	gd->first_minor = MINOR(devno);

_

  reply	other threads:[~2004-05-03 15:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-22 21:36 Transport affected timeouts Smart, James
2004-04-22 21:45 ` Brian King
2004-05-03 15:47   ` Brian King [this message]
2004-05-19  0:46     ` [PATCH] scsi_timeout_mod Masao Fukuchi
2004-05-03 15:49   ` Transport affected timeouts Brian King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=409669AB.7030207@us.ibm.com \
    --to=brking@us.ibm.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=James.Smart@Emulex.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox