Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] tmscsim: scsi device attributes
@ 2004-10-21 20:31 Guennadi Liakhovetski
  2004-10-22 12:40 ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: Guennadi Liakhovetski @ 2004-10-21 20:31 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

A write method to adjust per-device queue-depth

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

diff -u a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
--- a/drivers/scsi/tmscsim.c	Wed Oct 20 21:49:46 2004
+++ b/drivers/scsi/tmscsim.c	Thu Oct 21 22:03:35 2004
@@ -2275,6 +2275,33 @@
 	return 0;
 }
 
+static ssize_t dc390_store_queue_depth(struct device *dev, const char *buf, size_t count)
+{
+	struct scsi_device *sdev = to_scsi_device(dev);
+	struct dc390_acb *acb = (struct dc390_acb *)sdev->host->hostdata;
+	int queue_depth = simple_strtoul(buf, NULL, 0);
+
+	if (queue_depth > acb->TagMaxNum || !sdev->tagged_supported)
+		return -EINVAL;
+
+	scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
+
+	return count;
+}
+
+static struct device_attribute dc390_queue_depth_attr = {
+	.attr = {
+		.name =		"queue_depth",
+		.mode =		S_IRUSR | S_IWUSR,
+	},
+	.store = dc390_store_queue_depth
+};
+
+static struct device_attribute *dc390_dev_attrs[] = {
+	&dc390_queue_depth_attr,
+	NULL,
+};
+
 static struct scsi_host_template driver_template = {
 	.module			= THIS_MODULE,
 	.proc_name		= "tmscsim", 
@@ -2290,6 +2317,7 @@
 	.sg_tablesize		= SG_ALL,
 	.cmd_per_lun		= 1,
 	.use_clustering		= DISABLE_CLUSTERING,
+	.sdev_attrs		= dc390_dev_attrs,
 };
 
 /***********************************************************************

Thanks
Guennadi
---
Guennadi Liakhovetski

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-10-22 21:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-21 20:31 [PATCH] tmscsim: scsi device attributes Guennadi Liakhovetski
2004-10-22 12:40 ` Matthew Wilcox
2004-10-22 13:00   ` James Bottomley
2004-10-22 19:27     ` Guennadi Liakhovetski

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