Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 3248

kernel-2.6.18-194.11.1.el5.src.rpm

From: Pete Zaitcev <zaitcev@redhat.com>
Date: Fri, 20 Nov 2009 06:01:06 -0500
Subject: [s390] zfcp_scsi: dynamic queue depth adjustment param
Message-id: <20091119230106.013fbe5b@redhat.com>
Patchwork-id: 21448
O-Subject: [RHEL 5.5 patch]  s390 zfcp: parameter to dynamically adjust queue
	depth
Bugzilla: 508355
RH-Acked-by: David Milburn <dmilburn@redhat.com>
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
RH-Acked-by: Mike Christie <mchristi@redhat.com>
RH-Acked-by: Neil Horman <nhorman@redhat.com>

This is a backport to add a knob to zfcp driver. It was tested by Novell,
since they ship it. It is also in upstream (2.6.32-rc6 at least, not sure
when it went it precisely). I'm no big fan of knobs, but IBM is asking
for it and customer is always right.

I compile-tested this, just in case.

Please ack.

-- Pete

diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 8e38afe..57d51ce 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -24,6 +24,11 @@
 #include "zfcp_ext.h"
 #include <asm/atomic.h>
 
+static unsigned int default_depth = 32;
+module_param_named(queue_depth, default_depth, uint, 0600);
+MODULE_PARM_DESC(queue_depth, "Default queue depth for new SCSI devices");
+
+static int zfcp_scsi_change_queue_depth(struct scsi_device *, int);
 static void zfcp_scsi_slave_destroy(struct scsi_device *sdp);
 static int zfcp_scsi_slave_alloc(struct scsi_device *sdp);
 static int zfcp_scsi_slave_configure(struct scsi_device *sdp);
@@ -46,6 +51,7 @@ struct zfcp_data zfcp_data = {
 	.scsi_host_template = {
 		.name			= ZFCP_NAME,
 		.proc_name		= "zfcp",
+		.change_queue_depth	= zfcp_scsi_change_queue_depth,
 		.slave_alloc		= zfcp_scsi_slave_alloc,
 		.slave_configure	= zfcp_scsi_slave_configure,
 		.slave_destroy		= zfcp_scsi_slave_destroy,
@@ -122,6 +128,12 @@ zfcp_set_fcp_dl(struct fcp_cmnd_iu *fcp_cmd, fcp_dl_t fcp_dl)
 	*zfcp_get_fcp_dl_ptr(fcp_cmd) = fcp_dl;
 }
 
+static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth)
+{
+	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
+	return sdev->queue_depth;
+}
+
 /*
  * note: it's a bit-or operation not an assignment
  * regarding the specified byte
@@ -200,7 +212,7 @@ static int
 zfcp_scsi_slave_configure(struct scsi_device *sdp)
 {
 	if (sdp->tagged_supported)
-		scsi_adjust_queue_depth(sdp, MSG_SIMPLE_TAG, ZFCP_CMND_PER_LUN);
+		scsi_adjust_queue_depth(sdp, MSG_SIMPLE_TAG, default_depth);
 	else
 		scsi_adjust_queue_depth(sdp, 0, 1);
 	return 0;