From: Vasu Dev <vasu.dev@intel.com>
To: michaelc@cs.wisc.edu, linux-scsi@vger.kernel.org
Subject: [RFC PATCH 6/9] scsi: adds sdev->queue_ramp_up_period to sysfs
Date: Wed, 26 Aug 2009 11:03:47 -0700 [thread overview]
Message-ID: <20090826180347.23396.93178.stgit@vi1.jf.intel.com> (raw)
In-Reply-To: <20090826180234.23396.8148.stgit@vi1.jf.intel.com>
Adds sysfs functions to show or store sdev->queue_ramp_up_period.
Adds queue_ramp_up_period to sysfs if change_queue_depth is
supported since ramp up is needed only in case the dynamic
queue_depth change is supported first.
Initializes queue_ramp_up_period to 120HZ jiffies as initial
default value.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/scsi/scsi_scan.c | 1 +
drivers/scsi/scsi_sysfs.c | 38 ++++++++++++++++++++++++++++++++++++--
include/scsi/scsi_device.h | 2 ++
3 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index c447838..0e6db8b 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -251,6 +251,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
sdev->model = scsi_null_device_strs;
sdev->rev = scsi_null_device_strs;
sdev->host = shost;
+ sdev->queue_ramp_up_period = SCSI_DEFAULT_RAMP_UP_PERIOD;
sdev->id = starget->id;
sdev->lun = lun;
sdev->channel = starget->channel;
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index c26c53c..28dbc35 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -779,6 +779,36 @@ static struct device_attribute sdev_attr_queue_depth_rw =
sdev_store_queue_depth_rw);
static ssize_t
+sdev_show_queue_ramp_up_period(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct scsi_device *sdev;
+ sdev = to_scsi_device(dev);
+ return snprintf(buf, 20, "%lu\n", sdev->queue_ramp_up_period);
+}
+
+static ssize_t
+sdev_store_queue_ramp_up_period(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct scsi_device *sdev = to_scsi_device(dev);
+ unsigned long period;
+
+ if (strict_strtoul(buf, 10, &period))
+ return -EINVAL;
+
+ sdev->queue_ramp_up_period = period;
+ return period;
+}
+
+static struct device_attribute sdev_attr_queue_ramp_up_period =
+ __ATTR(queue_ramp_up_period, S_IRUGO | S_IWUSR,
+ sdev_show_queue_ramp_up_period,
+ sdev_store_queue_ramp_up_period);
+
+static ssize_t
sdev_store_queue_type_rw(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
@@ -870,8 +900,12 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
get_device(&sdev->sdev_gendev);
/* create queue files, which may be writable, depending on the host */
- if (sdev->host->hostt->change_queue_depth)
- error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_depth_rw);
+ if (sdev->host->hostt->change_queue_depth) {
+ error = device_create_file(&sdev->sdev_gendev,
+ &sdev_attr_queue_depth_rw);
+ error = device_create_file(&sdev->sdev_gendev,
+ &sdev_attr_queue_ramp_up_period);
+ }
else
error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_depth);
if (error) {
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 041d4f9..899f501 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -85,6 +85,8 @@ struct scsi_device {
unsigned short last_queue_full_count; /* scsi_track_queue_full() */
unsigned long last_queue_full_time; /* last queue full time */
unsigned long queue_ramp_up_period; /* ramp up period in jiffies */
+#define SCSI_DEFAULT_RAMP_UP_PERIOD (120 * HZ)
+
unsigned long last_queue_ramp_up; /* last queue ramp up time */
unsigned int id, lun, channel;
next prev parent reply other threads:[~2009-08-26 18:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-26 18:03 [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c Vasu Dev
2009-08-26 18:03 ` [RFC PATCH 1/9] scsi-ml: modify change_queue_depth to take in reason why it is being called Vasu Dev
2009-08-27 10:21 ` Christof Schmitt
2009-08-27 21:09 ` Vasu Dev
2009-08-28 16:56 ` Mike Christie
2009-08-26 18:03 ` [RFC PATCH 2/9] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL Vasu Dev
2009-08-26 18:03 ` [RFC PATCH 3/9] drivers: convert drivers setting the change_queue_depth callback Vasu Dev
2009-08-26 18:19 ` Jeff Garzik
2009-08-26 21:50 ` Vasu Dev
2009-08-26 21:55 ` Mike Christie
2009-08-26 18:03 ` [RFC PATCH 4/9] drivers: convert fc drivers calling scsi_track_queue_full Vasu Dev
2009-08-26 18:03 ` [RFC PATCH 5/9] scsi: updates sdev to add queue_depth ramp up code Vasu Dev
2009-08-26 18:03 ` Vasu Dev [this message]
2009-08-26 18:03 ` [RFC PATCH 7/9] scsi: add common " Vasu Dev
2009-08-26 18:03 ` [RFC PATCH 8/9] fcoe, libfc: fix an libfc issue with queue ramp down in libfc Vasu Dev
2009-08-26 18:04 ` [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc Vasu Dev
2009-08-27 10:19 ` Christof Schmitt
2009-08-27 20:56 ` Vasu Dev
2009-08-28 10:44 ` Christof Schmitt
2009-09-02 18:00 ` Vasu Dev
2009-09-01 22:57 ` [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c Vasu Dev
2009-09-02 1:46 ` Mike Christie
2009-09-02 18:01 ` Vasu Dev
2009-09-03 8:17 ` Swen Schillig
2009-09-14 11:21 ` Christof Schmitt
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=20090826180347.23396.93178.stgit@vi1.jf.intel.com \
--to=vasu.dev@intel.com \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.