Skip to contentSkip to conversation

ibmvscsi: Changeable queue depth

PATCH New James Bottomley 2 participants 2 messages May 29, 2007 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 11804616242477-patch-mail.ibm.com

#1 lore raw
Quoted 16 lines · Brian King

Adds support for a changeable queue depth to ibmvscsi.

---

 linux-2.6-bjking1/drivers/scsi/ibmvscsi/ibmvscsi.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff -puN drivers/scsi/ibmvscsi/ibmvscsi.c~ibmvscsi_change_q_depth drivers/scsi/ibmvscsi/ibmvscsi.c

drivers/scsi/ibmvscsi/ibmvscsi.c renamed from drivers/scsi/ibmvscsi/ibmvscsi.c~ibmvscsi_change_q_depth +1 -0
@@ -1375,6 +1375,20 @@ static int ibmvscsi_slave_configure(stru
 	return 0;
 }
 
+/**

drivers/scsi/ibmvscsi/ibmvscsi.c static int ibmvscsi_slave_configure(stru · line 1388

Quoted 10 lines
drivers/scsi/ibmvscsi/ibmvscsi.c renamed from drivers/scsi/ibmvscsi/ibmvscsi.c~ibmvscsi_change_q_depth +10 -0
+ * ibmvscsi_change_queue_depth - Change the device's queue depth
+ * @sdev:	scsi device struct
+ * @qdepth:	depth to set
+ *
+ * Return value:
+ * 	actual depth set
+ **/
+static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth)
+{
+	scsi_adjust_queue_depth(sdev, 0, qdepth);

Don't you want to check this against some system limit ... or will the driver cope just fine when the user sets it to machine infinity and we diligently try blasting away at it through the queuecommand() routine?

The usual limit, if you have variable queues ... is the maximum the device could ever accept ... although some people adjust that downwards because of device starvation fears.

drivers/scsi/ibmvscsi/ibmvscsi.c static int ibmvscsi_slave_configure(stru · line 1390

Quoted 2 lines
drivers/scsi/ibmvscsi/ibmvscsi.c renamed from drivers/scsi/ibmvscsi/ibmvscsi.c~ibmvscsi_change_q_depth +2 -0
+	return sdev->queue_depth;
+}

James

#2 lore raw

PATCH 1/1 ibmvscsi: Changeable queue depth

Adds support for a changeable queue depth to ibmvscsi.

---

Quoted 7 lines · James Bottomley

Don't you want to check this against some system limit ... or will the driver cope just fine when the user sets it to machine infinity and we diligently try blasting away at it through the queuecommand() routine?

The usual limit, if you have variable queues ... is the maximum the device could ever accept ... although some people adjust that downwards because of device starvation fears.

There isn't anything coming back from the VIO server to indicate what this max value is for the LUN, so we have to use an arbitrary value. I chose 64 since its generally the max queue depth supported by a single disk supported on pSeries. Here is an updated patch.

-Brian

---

 linux-2.6-bjking1/drivers/scsi/ibmvscsi/ibmvscsi.c |   18 ++++++++++++++++++
 linux-2.6-bjking1/drivers/scsi/ibmvscsi/ibmvscsi.h |    1 +
 2 files changed, 19 insertions(+)
drivers/scsi/ibmvscsi/ibmvscsi.c renamed from drivers/scsi/ibmvscsi/ibmvscsi.c~ibmvscsi_change_q_depth +18 -0
diff -puN drivers/scsi/ibmvscsi/ibmvscsi.c~ibmvscsi_change_q_depth drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1375,6 +1375,23 @@ static int ibmvscsi_slave_configure(stru
 	return 0;
 }
 
+/**
+ * ibmvscsi_change_queue_depth - Change the device's queue depth
+ * @sdev:	scsi device struct
+ * @qdepth:	depth to set
+ *
+ * Return value:
+ * 	actual depth set
+ **/
+static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth)
+{
+	if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN)
+		qdepth = IBMVSCSI_MAX_CMDS_PER_LUN;
+
+	scsi_adjust_queue_depth(sdev, 0, qdepth);
+	return sdev->queue_depth;
+}
+
 /* ------------------------------------------------------------
  * sysfs attributes
  */
@@ -1521,6 +1538,7 @@ static struct scsi_host_template driver_
 	.eh_abort_handler = ibmvscsi_eh_abort_handler,
 	.eh_device_reset_handler = ibmvscsi_eh_device_reset_handler,
 	.slave_configure = ibmvscsi_slave_configure,
+	.change_queue_depth = ibmvscsi_change_queue_depth,
 	.cmd_per_lun = 16,
 	.can_queue = IBMVSCSI_MAX_REQUESTS_DEFAULT,
 	.this_id = -1,
drivers/scsi/ibmvscsi/ibmvscsi.h renamed from drivers/scsi/ibmvscsi/ibmvscsi.h~ibmvscsi_change_q_depth +1 -0
diff -puN drivers/scsi/ibmvscsi/ibmvscsi.h~ibmvscsi_change_q_depth drivers/scsi/ibmvscsi/ibmvscsi.h
@@ -45,6 +45,7 @@ struct Scsi_Host;
 #define MAX_INDIRECT_BUFS 10
 
 #define IBMVSCSI_MAX_REQUESTS_DEFAULT 100
+#define IBMVSCSI_MAX_CMDS_PER_LUN 64
 
 /* ------------------------------------------------------------
  * Data Structures

_