public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Smart <jsmart2021@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: James Smart <jsmart2021@gmail.com>
Subject: [PATCH v2 3/3] scsi: add shost attribute to set max queue depth on all devices on the shost
Date: Thu, 23 Jan 2020 14:21:02 -0800	[thread overview]
Message-ID: <20200123222102.23383-4-jsmart2021@gmail.com> (raw)
In-Reply-To: <20200123222102.23383-1-jsmart2021@gmail.com>

This patch adds an shost attribute, max_device_queue_depth, that will
cycle through all devices on the shost and change their current and max
queue depth to the new value.

Signed-off-by: James Smart <jsmart2021@gmail.com>
---
 drivers/scsi/scsi_sysfs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 954f68b002cb..85dab4867eed 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -368,6 +368,23 @@ store_shost_eh_deadline(struct device *dev, struct device_attribute *attr,
 
 static DEVICE_ATTR(eh_deadline, S_IRUGO | S_IWUSR, show_shost_eh_deadline, store_shost_eh_deadline);
 
+static ssize_t
+store_host_max_device_queue_depth(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct Scsi_Host *shost = class_to_shost(dev);
+	int depth, retval;
+
+	depth = simple_strtoul(buf, NULL, 0);
+
+	retval = shost_change_max_queue_depths(shost, depth);
+
+	return (retval < 0) ? retval : count;
+}
+
+static DEVICE_ATTR(max_device_queue_depth, S_IWUSR, NULL,
+		   store_host_max_device_queue_depth);
+
 shost_rd_attr(unique_id, "%u\n");
 shost_rd_attr(cmd_per_lun, "%hd\n");
 shost_rd_attr(can_queue, "%hd\n");
@@ -411,6 +428,7 @@ static struct attribute *scsi_sysfs_shost_attrs[] = {
 	&dev_attr_prot_guard_type.attr,
 	&dev_attr_host_reset.attr,
 	&dev_attr_eh_deadline.attr,
+	&dev_attr_max_device_queue_depth.attr,
 	NULL
 };
 
-- 
2.13.7


  parent reply	other threads:[~2020-01-23 22:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23 22:20 [PATCH v2 0/3] scsi: add attribute to set lun queue depth on all luns on shost James Smart
2020-01-23 22:21 ` [PATCH v2 1/3] scsi: refactor sdev lun queue depth setting via sysfs James Smart
2020-01-24  2:48   ` Bart Van Assche
2020-01-23 22:21 ` [PATCH v2 2/3] scsi: add shost helper to set max queue depth on all of its devices James Smart
2020-01-24  2:52   ` Bart Van Assche
2020-01-23 22:21 ` James Smart [this message]
2020-01-24  2:55   ` [PATCH v2 3/3] scsi: add shost attribute to set max queue depth on all devices on the shost Bart Van Assche

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=20200123222102.23383-4-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.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