All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c
@ 2009-08-26 18:03 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
                   ` (9 more replies)
  0 siblings, 10 replies; 25+ messages in thread
From: Vasu Dev @ 2009-08-26 18:03 UTC (permalink / raw)
  To: michaelc, linux-scsi

First four patches are from Mike Christie's original RFC at:-

http://www.spinics.net/lists/linux-scsi/msg35959.html
http://www.spinics.net/lists/linux-scsi/msg35962.html
http://www.spinics.net/lists/linux-scsi/msg35961.html
http://www.spinics.net/lists/linux-scsi/msg35963.html
http://www.spinics.net/lists/linux-scsi/msg35964.html

Above four patches adds ramp down code and I appended ramp
up code in following patches and tested this entire
series with libfc/fcoe. This series works fine without any
regression and also queue_depth adjustment works for both
ramp down and ramp up.

Above patches are updated to scsi-misc -rc7 plus recently
submitted 64 fcoe patches series by Rob
"[PATCH 00/64] libfc, libfcoe and fcoe updates for scsi-misc"
This series also applies cleanly to scsi-misc -rc7.

I'd appreciate review comments for added more patches for
ramp up.

I'll post my final patches to this list skipping fcoe list,
this as per Rob Love suggestion since mostly scsi changes
by this series beyond fcoe/libfc. However Rob agreed to
review/Ack fcoe/libfc changes at this list.

Mike, I'll be able to post my ramp up patches only once
you send final patches for ramp down on which my patches
depends. As I said your patches are tested for libfc,
so most common code is already tested and they are
good go as far as libfc goes.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>

---

Mike Christie (4):
      drivers: convert fc drivers calling scsi_track_queue_full
      drivers: convert drivers setting the change_queue_depth callback
      scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL
      scsi-ml: modify change_queue_depth to take in reason why it is being called

Vasu Dev (5):
      libfc: adds queue_depth ramp up to libfc
      fcoe, libfc: fix an libfc issue with queue ramp down in libfc
      scsi: add common queue_depth ramp up code
      scsi: adds sdev->queue_ramp_up_period to sysfs
      scsi: updates sdev to add queue_depth ramp up code


 drivers/ata/libata-scsi.c             |    6 ++-
 drivers/ata/sata_nv.c                 |    2 -
 drivers/message/fusion/mptscsih.c     |    8 +++-
 drivers/message/fusion/mptscsih.h     |    3 +
 drivers/scsi/3w-9xxx.c                |    5 ++
 drivers/scsi/3w-xxxx.c                |    5 ++
 drivers/scsi/53c700.c                 |    5 ++
 drivers/scsi/aacraid/linit.c          |    6 ++-
 drivers/scsi/arcmsr/arcmsr_hba.c      |    5 ++
 drivers/scsi/fcoe/fcoe.c              |    2 -
 drivers/scsi/hptiop.c                 |    5 ++
 drivers/scsi/ibmvscsi/ibmvfc.c        |    7 +++
 drivers/scsi/ibmvscsi/ibmvscsi.c      |    7 +++
 drivers/scsi/ipr.c                    |    7 +++
 drivers/scsi/libfc/fc_fcp.c           |   47 ++++++++++-----------
 drivers/scsi/libsas/sas_scsi_host.c   |    6 ++-
 drivers/scsi/lpfc/lpfc_scsi.c         |   75 ++++++++++++++++++---------------
 drivers/scsi/megaraid/megaraid_mbox.c |    7 +++
 drivers/scsi/mpt2sas/mpt2sas_scsih.c  |   10 +++-
 drivers/scsi/qla2xxx/qla_isr.c        |   32 --------------
 drivers/scsi/qla2xxx/qla_os.c         |   32 +++++++++++++-
 drivers/scsi/scsi.c                   |   10 ++++
 drivers/scsi/scsi_error.c             |   64 ++++++++++++++++++++++++++++
 drivers/scsi/scsi_scan.c              |    1 
 drivers/scsi/scsi_sysfs.c             |   41 +++++++++++++++++-
 include/linux/libata.h                |    2 -
 include/scsi/libfc.h                  |    2 -
 include/scsi/libsas.h                 |    3 +
 include/scsi/scsi_device.h            |    8 ++--
 include/scsi/scsi_host.h              |    9 ++++
 30 files changed, 295 insertions(+), 127 deletions(-)

-- 
Signature

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

* [RFC PATCH 1/9] scsi-ml: modify change_queue_depth to take in reason why it is being called
  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 ` Vasu Dev
  2009-08-27 10:21   ` Christof Schmitt
  2009-08-26 18:03 ` [RFC PATCH 2/9] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL Vasu Dev
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Vasu Dev @ 2009-08-26 18:03 UTC (permalink / raw)
  To: michaelc, linux-scsi

From: Mike Christie <michaelc@cs.wisc.edu>

This patch modifies scsi_host_tematepl->change_queue_depth so that
it takes an argument indicating why it is being called. This will be
used so that if a LLD needs to do some extra processing when
handling queue fulls or later ramp ups, it can do so.

To simplify the review, this patch only modifies scsi-ml. The next
patches will convert each driver.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---

 drivers/scsi/scsi_sysfs.c |    3 ++-
 include/scsi/scsi_host.h  |    9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 91482f2..c26c53c 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -766,7 +766,8 @@ sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr,
 	if (depth < 1)
 		return -EINVAL;
 
-	retval = sht->change_queue_depth(sdev, depth);
+	retval = sht->change_queue_depth(sdev, depth,
+					 SCSI_QDEPTH_SYSFS_REQ);
 	if (retval < 0)
 		return retval;
 
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index b62a097..e0038fa 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -43,6 +43,13 @@ struct blk_queue_tags;
 #define DISABLE_CLUSTERING 0
 #define ENABLE_CLUSTERING 1
 
+enum {
+	SCSI_QDEPTH_SYSFS_REQ,	/* user requested change through sysfs */
+	SCSI_QDEPTH_QFULL,	/* scsi-ml requested due to queue full */
+	SCSI_QDEPTH_RAMP_UP,	/* scsi-ml requested due to threshhold event */
+	SCSI_QDEPTH_RAMP_DOWN, 	/* LLD/class requested due to lld/class event */
+};
+
 struct scsi_host_template {
 	struct module *module;
 	const char *name;
@@ -294,7 +301,7 @@ struct scsi_host_template {
 	 *
 	 * Status: OPTIONAL
 	 */
-	int (* change_queue_depth)(struct scsi_device *, int);
+	int (* change_queue_depth)(struct scsi_device *, int, int);
 
 	/*
 	 * Fill in this function to allow the changing of tag types


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

* [RFC PATCH 2/9] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL
  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-26 18:03 ` Vasu Dev
  2009-08-26 18:03 ` [RFC PATCH 3/9] drivers: convert drivers setting the change_queue_depth callback Vasu Dev
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Vasu Dev @ 2009-08-26 18:03 UTC (permalink / raw)
  To: michaelc, linux-scsi

From: Mike Christie <michaelc@cs.wisc.edu>

This has scsi-ml call the change_queue_depth functions when
we get a QUEUE_FULL. It will only change the queue depth if
change_queue_depth is set because the LLD may have to
modify some internal resources, so I thought this would
be the safest route.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---

 drivers/scsi/scsi_error.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 877204d..7d1b862 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -331,6 +331,27 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
 	}
 }
 
+static void scsi_handle_queue_full(struct scsi_device *sdev)
+{
+	struct scsi_host_template *sht = sdev->host->hostt;
+	struct scsi_device *tmp_sdev;
+
+	if (!sht->change_queue_depth)
+		return;
+
+	shost_for_each_device(tmp_sdev, sdev->host) {
+		if (tmp_sdev->id != sdev->id)
+			continue;
+		/*
+		 * We do not know the number of commands that were at
+		 * the device when we got the queue full so we start
+		 * from the highest possible value and work our way down.
+		 */
+		sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth - 1,
+					SCSI_QDEPTH_QFULL);
+	}
+}
+
 /**
  * scsi_eh_completed_normally - Disposition a eh cmd on return from LLD.
  * @scmd:	SCSI cmd to examine.
@@ -387,8 +408,10 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
 		 * let issuer deal with this, it could be just fine
 		 */
 		return SUCCESS;
-	case BUSY:
 	case QUEUE_FULL:
+		scsi_handle_queue_full(scmd->device);
+		/* fall through */
+	case BUSY:
 	default:
 		return FAILED;
 	}
@@ -1384,6 +1407,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
 	 */
 	switch (status_byte(scmd->result)) {
 	case QUEUE_FULL:
+		scsi_handle_queue_full(scmd->device);
 		/*
 		 * the case of trying to send too many commands to a
 		 * tagged queueing device.


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

* [RFC PATCH 3/9] drivers: convert drivers setting the change_queue_depth callback
  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-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 ` Vasu Dev
  2009-08-26 18:19   ` Jeff Garzik
  2009-08-26 18:03 ` [RFC PATCH 4/9] drivers: convert fc drivers calling scsi_track_queue_full Vasu Dev
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Vasu Dev @ 2009-08-26 18:03 UTC (permalink / raw)
  To: michaelc, linux-scsi

From: Mike Christie <michaelc@cs.wisc.edu>

This is a simple port of the drivers setting a change_queue_depth
callback but were not tracking queue fulls. In the patch I just have
these LLDs adjust the queue depth if the user was requesting it.

Patch is only compile tested.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---

 drivers/ata/libata-scsi.c             |    6 +++++-
 drivers/ata/sata_nv.c                 |    2 +-
 drivers/message/fusion/mptscsih.c     |    8 ++++++--
 drivers/message/fusion/mptscsih.h     |    3 ++-
 drivers/scsi/3w-9xxx.c                |    5 ++++-
 drivers/scsi/3w-xxxx.c                |    5 ++++-
 drivers/scsi/53c700.c                 |    5 ++++-
 drivers/scsi/aacraid/linit.c          |    6 +++++-
 drivers/scsi/arcmsr/arcmsr_hba.c      |    5 ++++-
 drivers/scsi/hptiop.c                 |    5 ++++-
 drivers/scsi/ibmvscsi/ibmvfc.c        |    7 ++++++-
 drivers/scsi/ibmvscsi/ibmvscsi.c      |    7 ++++++-
 drivers/scsi/ipr.c                    |    7 ++++++-
 drivers/scsi/libsas/sas_scsi_host.c   |    6 +++++-
 drivers/scsi/megaraid/megaraid_mbox.c |    7 ++++++-
 drivers/scsi/mpt2sas/mpt2sas_scsih.c  |   10 +++++++---
 include/linux/libata.h                |    2 +-
 include/scsi/libsas.h                 |    3 ++-
 18 files changed, 78 insertions(+), 21 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index d0dfeef..43ba02a 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1223,12 +1223,16 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
  *	RETURNS:
  *	Newly configured queue depth.
  */
-int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth)
+int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+				int reason)
 {
 	struct ata_port *ap = ata_shost_to_port(sdev->host);
 	struct ata_device *dev;
 	unsigned long flags;
 
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	if (queue_depth < 1 || queue_depth == sdev->queue_depth)
 		return sdev->queue_depth;
 
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 86a4058..fb28be9 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1963,7 +1963,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)
 	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
 
 	if (strncmp(model_num, "Maxtor", 6) == 0) {
-		ata_scsi_change_queue_depth(sdev, 1);
+		ata_scsi_change_queue_depth(sdev, 1, SCSI_QDEPTH_SYSFS_REQ);
 		ata_dev_printk(dev, KERN_NOTICE,
 			"Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth);
 	}
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 0e402eb..fcbbd8a 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2269,7 +2269,7 @@ mptscsih_slave_destroy(struct scsi_device *sdev)
  *	Adding support for new 'change_queue_depth' api.
 */
 int
-mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
+mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
 {
 	MPT_SCSI_HOST		*hd = shost_priv(sdev->host);
 	VirtTarget 		*vtarget;
@@ -2281,6 +2281,9 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
 	starget = scsi_target(sdev);
 	vtarget = starget->hostdata;
 
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	if (ioc->bus_type == SPI) {
 		if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES))
 			max_depth = 1;
@@ -2347,7 +2350,8 @@ mptscsih_slave_configure(struct scsi_device *sdev)
 		    ioc->name, vtarget->negoFlags, vtarget->maxOffset,
 		    vtarget->minSyncFactor));
 
-	mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH);
+	mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH,
+				    SCSI_QDEPTH_SYSFS_REQ);
 	dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
 		"tagged %d, simple %d, ordered %d\n",
 		ioc->name,sdev->tagged_supported, sdev->simple_tags,
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index e0b33e0..45a5ff3 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -128,7 +128,8 @@ extern int mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_F
 extern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r);
 extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
 extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
-extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth);
+extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth,
+				       int reason);
 extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id);
 extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id);
 extern struct device_attribute *mptscsih_host_attrs[];
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 36c21b1..c3d49b3 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -186,8 +186,11 @@ static ssize_t twa_show_stats(struct device *dev,
 } /* End twa_show_stats() */
 
 /* This function will set a devices queue depth */
-static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth)
+static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+				  int reason)
 {
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
 	if (queue_depth > TW_Q_LENGTH-2)
 		queue_depth = TW_Q_LENGTH-2;
 	scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index faa0fcf..5bc1251 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -521,8 +521,11 @@ static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr,
 } /* End tw_show_stats() */
 
 /* This function will set a devices queue depth */
-static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth)
+static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+				 int reason)
 {
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
 	if (queue_depth > TW_Q_LENGTH-2)
 		queue_depth = TW_Q_LENGTH-2;
 	scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index f5a9add..8fea91a 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -2082,8 +2082,11 @@ NCR_700_slave_destroy(struct scsi_device *SDp)
 }
 
 static int
-NCR_700_change_queue_depth(struct scsi_device *SDp, int depth)
+NCR_700_change_queue_depth(struct scsi_device *SDp, int depth, int reason)
 {
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	if (depth > NCR_700_MAX_TAGS)
 		depth = NCR_700_MAX_TAGS;
 
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 9b97c3e..0b4605a 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -472,8 +472,12 @@ static int aac_slave_configure(struct scsi_device *sdev)
  *	total capacity and the queue depth supported by the target device.
  */
 
-static int aac_change_queue_depth(struct scsi_device *sdev, int depth)
+static int aac_change_queue_depth(struct scsi_device *sdev, int depth,
+				  int reason)
 {
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	if (sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
 	    (sdev_channel(sdev) == CONTAINER_CHANNEL)) {
 		struct scsi_device * dev;
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 80aac01..a3d0ded 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -98,8 +98,11 @@ static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb);
 static const char *arcmsr_info(struct Scsi_Host *);
 static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb);
 static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev,
-								int queue_depth)
+					  int queue_depth, int reason)
 {
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	if (queue_depth > ARCMSR_MAX_CMD_PERLUN)
 		queue_depth = ARCMSR_MAX_CMD_PERLUN;
 	scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index c596ab5..a2f3c41 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -847,10 +847,13 @@ static int hptiop_reset(struct scsi_cmnd *scp)
 }
 
 static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev,
-						int queue_depth)
+					  int queue_depth, int reason)
 {
 	struct hptiop_hba *hba = (struct hptiop_hba *)sdev->host->hostdata;
 
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	if (queue_depth > hba->max_requests)
 		queue_depth = hba->max_requests;
 	scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index bb2c696..2f4230a 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -2478,12 +2478,17 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev)
  * ibmvfc_change_queue_depth - Change the device's queue depth
  * @sdev:	scsi device struct
  * @qdepth:	depth to set
+ * @reason:	calling context
  *
  * Return value:
  * 	actual depth set
  **/
-static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth,
+				     int reason)
 {
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	if (qdepth > IBMVFC_MAX_CMDS_PER_LUN)
 		qdepth = IBMVFC_MAX_CMDS_PER_LUN;
 
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 9928704..5da1835 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1638,12 +1638,17 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev)
  * ibmvscsi_change_queue_depth - Change the device's queue depth
  * @sdev:	scsi device struct
  * @qdepth:	depth to set
+ * @reason:	calling context
  *
  * Return value:
  * 	actual depth set
  **/
-static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth,
+				       int reason)
 {
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN)
 		qdepth = IBMVSCSI_MAX_CMDS_PER_LUN;
 
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 5f04550..0095d27 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -3367,16 +3367,21 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) { return 0; };
  * ipr_change_queue_depth - Change the device's queue depth
  * @sdev:	scsi device struct
  * @qdepth:	depth to set
+ * @reason:	calling context
  *
  * Return value:
  * 	actual depth set
  **/
-static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth,
+				  int reason)
 {
 	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
 	struct ipr_resource_entry *res;
 	unsigned long lock_flags = 0;
 
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
 	res = (struct ipr_resource_entry *)sdev->hostdata;
 
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 1c558d3..84230ae 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -820,10 +820,14 @@ void sas_slave_destroy(struct scsi_device *scsi_dev)
 		ata_port_disable(dev->sata_dev.ap);
 }
 
-int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth)
+int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth,
+			   int reason)
 {
 	int res = min(new_depth, SAS_MAX_QD);
 
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	if (scsi_dev->tagged_supported)
 		scsi_adjust_queue_depth(scsi_dev, scsi_get_tag_type(scsi_dev),
 					res);
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 234f0b7..dc17d75 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -335,12 +335,17 @@ static struct device_attribute *megaraid_sdev_attrs[] = {
  * megaraid_change_queue_depth - Change the device's queue depth
  * @sdev:	scsi device struct
  * @qdepth:	depth to set
+ * @reason:	calling context
  *
  * Return value:
  * 	actual depth set
  */
-static int megaraid_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int megaraid_change_queue_depth(struct scsi_device *sdev, int qdepth,
+				       int reason)
 {
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	if (qdepth > MBOX_MAX_SCSI_CMDS)
 		qdepth = MBOX_MAX_SCSI_CMDS;
 	scsi_adjust_queue_depth(sdev, 0, qdepth);
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 2e9a444..4af8a83 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -1085,16 +1085,20 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc,
  * _scsih_change_queue_depth - setting device queue depth
  * @sdev: scsi device struct
  * @qdepth: requested queue depth
+ * @reason: calling context
  *
  * Returns queue depth.
  */
 static int
-_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
+_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
 {
 	struct Scsi_Host *shost = sdev->host;
 	int max_depth;
 	int tag_type;
 
+	if (reason != SCSI_QDEPTH_SYSFS_REQ)
+		return -EOPNOTSUPP;
+
 	max_depth = shost->can_queue;
 	if (!sdev->tagged_supported)
 		max_depth = 1;
@@ -1524,7 +1528,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
 		    r_level, raid_device->handle,
 		    (unsigned long long)raid_device->wwid,
 		    raid_device->num_pds, ds);
-		_scsih_change_queue_depth(sdev, qdepth);
+		_scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_SYSFS_REQ);
 		return 0;
 	}
 
@@ -1570,7 +1574,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
 			_scsih_display_sata_capabilities(ioc, sas_device, sdev);
 	}
 
-	_scsih_change_queue_depth(sdev, qdepth);
+	_scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_SYSFS_REQ);
 
 	if (ssp_target)
 		sas_read_port_mode_page(sdev);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e5b6e33..a4744c8 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1010,7 +1010,7 @@ extern int ata_std_bios_param(struct scsi_device *sdev,
 extern int ata_scsi_slave_config(struct scsi_device *sdev);
 extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
 extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
-				       int queue_depth);
+				       int queue_depth, int reason);
 extern struct ata_device *ata_dev_pair(struct ata_device *adev);
 extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
 
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index e78d3b6..9eaa3f0 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -634,7 +634,8 @@ extern int sas_target_alloc(struct scsi_target *);
 extern int sas_slave_alloc(struct scsi_device *);
 extern int sas_slave_configure(struct scsi_device *);
 extern void sas_slave_destroy(struct scsi_device *);
-extern int sas_change_queue_depth(struct scsi_device *, int new_depth);
+extern int sas_change_queue_depth(struct scsi_device *, int new_depth,
+				  int reason);
 extern int sas_change_queue_type(struct scsi_device *, int qt);
 extern int sas_bios_param(struct scsi_device *,
 			  struct block_device *,


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

* [RFC PATCH 4/9] drivers: convert fc drivers calling scsi_track_queue_full
  2009-08-26 18:03 [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c Vasu Dev
                   ` (2 preceding siblings ...)
  2009-08-26 18:03 ` [RFC PATCH 3/9] drivers: convert drivers setting the change_queue_depth callback Vasu Dev
@ 2009-08-26 18:03 ` Vasu Dev
  2009-08-26 18:03 ` [RFC PATCH 5/9] scsi: updates sdev to add queue_depth ramp up code Vasu Dev
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Vasu Dev @ 2009-08-26 18:03 UTC (permalink / raw)
  To: michaelc, linux-scsi

From: Mike Christie <michaelc@cs.wisc.edu>

This converts the fc drivers that were using scsi_track_queue_full
to track the queue full from the change_queue_depth callback.

I have not yet tested the qla2xxx or lpfc parts.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>

--
Adds check to ignore SCSI_QDEPTH_QFULL in case the
ql2xqfulltracking is not set.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---

 drivers/scsi/libfc/fc_fcp.c    |   28 ++++++---------
 drivers/scsi/lpfc/lpfc_scsi.c  |   75 ++++++++++++++++++++++------------------
 drivers/scsi/qla2xxx/qla_isr.c |   32 -----------------
 drivers/scsi/qla2xxx/qla_os.c  |   32 +++++++++++++++--
 include/scsi/libfc.h           |    2 +
 5 files changed, 82 insertions(+), 87 deletions(-)

diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 59a4408..4037685 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -1814,21 +1814,6 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
 			sc_cmd->result = DID_OK << 16;
 			if (fsp->scsi_resid)
 				CMD_RESID_LEN(sc_cmd) = fsp->scsi_resid;
-		} else if (fsp->cdb_status == QUEUE_FULL) {
-			struct scsi_device *tmp_sdev;
-			struct scsi_device *sdev = sc_cmd->device;
-
-			shost_for_each_device(tmp_sdev, sdev->host) {
-				if (tmp_sdev->id != sdev->id)
-					continue;
-
-				if (tmp_sdev->queue_depth > 1) {
-					scsi_track_queue_full(tmp_sdev,
-							      tmp_sdev->
-							      queue_depth - 1);
-				}
-			}
-			sc_cmd->result = (DID_OK << 16) | fsp->cdb_status;
 		} else {
 			/*
 			 * transport level I/O was ok but scsi
@@ -2062,9 +2047,18 @@ int fc_slave_alloc(struct scsi_device *sdev)
 }
 EXPORT_SYMBOL(fc_slave_alloc);
 
-int fc_change_queue_depth(struct scsi_device *sdev, int qdepth)
+int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
 {
-	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+	switch (reason) {
+	case SCSI_QDEPTH_SYSFS_REQ:
+		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+		break;
+	case SCSI_QDEPTH_QFULL:
+		scsi_track_queue_full(sdev, qdepth);
+		break;
+	default:
+		return -EOPNOTSUPP;
+	}
 	return sdev->queue_depth;
 }
 EXPORT_SYMBOL(fc_change_queue_depth);
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 61d0897..2d39d84 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -2189,7 +2189,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
 	struct scsi_cmnd *cmd = lpfc_cmd->pCmd;
 	int result;
 	struct scsi_device *tmp_sdev;
-	int depth = 0;
 	unsigned long flags;
 	struct lpfc_fast_path_event *fast_path_evt;
 	struct Scsi_Host *shost = cmd->device->host;
@@ -2388,39 +2387,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
 	}
 
 	/*
-	 * Check for queue full.  If the lun is reporting queue full, then
-	 * back off the lun queue depth to prevent target overloads.
-	 */
-	if (result == SAM_STAT_TASK_SET_FULL && pnode &&
-	    NLP_CHK_NODE_ACT(pnode)) {
-		pnode->last_q_full_time = jiffies;
-
-		shost_for_each_device(tmp_sdev, shost) {
-			if (tmp_sdev->id != scsi_id)
-				continue;
-			depth = scsi_track_queue_full(tmp_sdev,
-					tmp_sdev->queue_depth - 1);
-		}
-		/*
-		 * The queue depth cannot be lowered any more.
-		 * Modify the returned error code to store
-		 * the final depth value set by
-		 * scsi_track_queue_full.
-		 */
-		if (depth == -1)
-			depth = shost->cmd_per_lun;
-
-		if (depth) {
-			lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
-					 "0711 detected queue full - lun queue "
-					 "depth adjusted to %d.\n", depth);
-			lpfc_send_sdev_queuedepth_change_event(phba, vport,
-				pnode, 0xFFFFFFFF,
-				depth+1, depth);
-		}
-	}
-
-	/*
 	 * If there is a thread waiting for command completion
 	 * wake up the thread.
 	 */
@@ -3551,6 +3517,45 @@ lpfc_slave_configure(struct scsi_device *sdev)
 	return 0;
 }
 
+static int lpfc_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+				   int reason)
+{
+	struct Scsi_Host *shost = sdev->host;
+	struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
+	struct lpfc_hba *phba = vport->phba;
+	struct lpfc_rport_data *rdata = sdev->hostdata;
+	struct lpfc_nodelist *pnode = rdata->pnode;
+	int depth;
+
+	if (reason != SCSI_QDEPTH_QFULL)
+		return -EOPNOTSUPP;
+
+	if (!pnode || !NLP_CHK_NODE_ACT(pnode))
+		return -EINVAL;
+
+	pnode->last_q_full_time = jiffies;
+
+	depth = scsi_track_queue_full(sdev, queue_depth);
+	/*
+	 * The queue depth cannot be lowered any more.
+	 * Modify the returned error code to store
+	 * the final depth value set by
+	 * scsi_track_queue_full.
+	 */
+	if (depth == -1)
+		depth = shost->cmd_per_lun;
+
+	if (depth) {
+		lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
+				 "0711 detected queue full - lun queue "
+				 "depth adjusted to %d.\n", depth);
+		lpfc_send_sdev_queuedepth_change_event(phba, vport,
+						       pnode, 0xFFFFFFFF,
+						       depth + 1, depth);
+	}
+	return sdev->queue_depth;
+}
+
 /**
  * lpfc_slave_destroy - slave_destroy entry point of SHT data structure
  * @sdev: Pointer to scsi_device.
@@ -3574,6 +3579,7 @@ struct scsi_host_template lpfc_template = {
 	.eh_device_reset_handler = lpfc_device_reset_handler,
 	.eh_target_reset_handler = lpfc_target_reset_handler,
 	.eh_bus_reset_handler	= lpfc_bus_reset_handler,
+	.change_queue_depth	= lpfc_change_queue_depth,
 	.slave_alloc		= lpfc_slave_alloc,
 	.slave_configure	= lpfc_slave_configure,
 	.slave_destroy		= lpfc_slave_destroy,
@@ -3596,6 +3602,7 @@ struct scsi_host_template lpfc_vport_template = {
 	.eh_device_reset_handler = lpfc_device_reset_handler,
 	.eh_target_reset_handler = lpfc_target_reset_handler,
 	.eh_bus_reset_handler	= lpfc_bus_reset_handler,
+	.change_queue_depth	= lpfc_change_queue_depth,
 	.slave_alloc		= lpfc_slave_alloc,
 	.slave_configure	= lpfc_slave_configure,
 	.slave_destroy		= lpfc_slave_destroy,
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 74fa6f9..66fda3a 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -836,20 +836,6 @@ qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, void *data)
 	    sdev->queue_depth));
 }
 
-static void
-qla2x00_adjust_sdev_qdepth_down(struct scsi_device *sdev, void *data)
-{
-	fc_port_t *fcport = data;
-
-	if (!scsi_track_queue_full(sdev, sdev->queue_depth - 1))
-		return;
-
-	DEBUG2(qla_printk(KERN_INFO, fcport->vha->hw,
-	    "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
-	    fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
-	    sdev->queue_depth));
-}
-
 static inline void
 qla2x00_ramp_up_queue_depth(scsi_qla_host_t *vha, struct req_que *req,
 								srb_t *sp)
@@ -1176,13 +1162,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
 			    "scsi(%ld): QUEUE FULL status detected "
 			    "0x%x-0x%x.\n", vha->host_no, comp_status,
 			    scsi_status));
-
-			/* Adjust queue depth for all luns on the port. */
-			if (!ql2xqfulltracking)
-				break;
-			fcport->last_queue_full = jiffies;
-			starget_for_each_device(cp->device->sdev_target,
-			    fcport, qla2x00_adjust_sdev_qdepth_down);
 			break;
 		}
 		if (lscsi_status != SS_CHECK_CONDITION)
@@ -1233,17 +1212,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
 				    "scsi(%ld): QUEUE FULL status detected "
 				    "0x%x-0x%x.\n", vha->host_no, comp_status,
 				    scsi_status));
-
-				/*
-				 * Adjust queue depth for all luns on the
-				 * port.
-				 */
-				if (!ql2xqfulltracking)
-					break;
-				fcport->last_queue_full = jiffies;
-				starget_for_each_device(
-				    cp->device->sdev_target, fcport,
-				    qla2x00_adjust_sdev_qdepth_down);
 				break;
 			}
 			if (lscsi_status != SS_CHECK_CONDITION)
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index d7b2713..a11c8ad 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -137,7 +137,7 @@ static int qla2xxx_eh_target_reset(struct scsi_cmnd *);
 static int qla2xxx_eh_bus_reset(struct scsi_cmnd *);
 static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
 
-static int qla2x00_change_queue_depth(struct scsi_device *, int);
+static int qla2x00_change_queue_depth(struct scsi_device *, int, int);
 static int qla2x00_change_queue_type(struct scsi_device *, int);
 
 struct scsi_host_template qla2xxx_driver_template = {
@@ -1222,10 +1222,36 @@ qla2xxx_slave_destroy(struct scsi_device *sdev)
 	sdev->hostdata = NULL;
 }
 
+static void qla2x00_handle_queue_full(struct scsi_device *sdev, int qdepth)
+{
+	fc_port_t *fcport = (struct fc_port *) sdev->hostdata;
+
+	fcport->last_queue_full = jiffies;
+
+	if (!scsi_track_queue_full(sdev, qdepth))
+		return;
+
+	DEBUG2(qla_printk(KERN_INFO, fcport->vha->hw,
+		"scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
+		fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
+		sdev->queue_depth));
+}
+
 static int
-qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth)
+qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
 {
-	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+	switch (reason) {
+	case SCSI_QDEPTH_SYSFS_REQ:
+		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+		break;
+	case SCSI_QDEPTH_QFULL:
+		if (!ql2xqfulltracking)
+			qla2x00_handle_queue_full(sdev, qdepth);
+		break;
+	default:
+		return EOPNOTSUPP;
+	}
+
 	return sdev->queue_depth;
 }
 
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 65dc9aa..9874ea7 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -919,7 +919,7 @@ int fc_slave_alloc(struct scsi_device *sdev);
 /*
  * Adjust the queue depth.
  */
-int fc_change_queue_depth(struct scsi_device *sdev, int qdepth);
+int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason);
 
 /*
  * Change the tag type.


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

* [RFC PATCH 5/9] scsi: updates sdev to add queue_depth ramp up code
  2009-08-26 18:03 [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c Vasu Dev
                   ` (3 preceding siblings ...)
  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 ` Vasu Dev
  2009-08-26 18:03 ` [RFC PATCH 6/9] scsi: adds sdev->queue_ramp_up_period to sysfs Vasu Dev
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Vasu Dev @ 2009-08-26 18:03 UTC (permalink / raw)
  To: michaelc, linux-scsi

Current FC HBA queue_depth ramp up code depends on :-

	1. last queue full time.
	2. last queue ramp up time.
	3. ramp up period (time interval)

The sdev already  has last_queue_full_time field to track last
queue full time but stored value is truncated by last four bits.

So this patch updates last_queue_full_time without truncating
last 4 bits to store complete value and then updates its only
current usages in scsi_track_queue_full to ignore last four bits
to keep current usages same. This will allow same
last_queue_full_time used by scsi_track_queue_full and queue_depth
ramp up code.

Adds additional new sdev fields for above 2 and 3 items.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---

 drivers/scsi/scsi.c        |   10 ++++++++--
 include/scsi/scsi_device.h |    6 +++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index b6e0307..bffaa9c 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -937,10 +937,16 @@ EXPORT_SYMBOL(scsi_adjust_queue_depth);
  */
 int scsi_track_queue_full(struct scsi_device *sdev, int depth)
 {
-	if ((jiffies >> 4) == sdev->last_queue_full_time)
+
+	/*
+	 * Don't let QUEUE_FULLs on the same
+	 * jiffies count, they could all be from
+	 * same event.
+	 */
+	if ((jiffies >> 4) == (sdev->last_queue_full_time >> 4))
 		return 0;
 
-	sdev->last_queue_full_time = (jiffies >> 4);
+	sdev->last_queue_full_time = jiffies;
 	if (sdev->last_queue_full_depth != depth) {
 		sdev->last_queue_full_count = 1;
 		sdev->last_queue_full_depth = depth;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 9af48cb..041d4f9 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -83,9 +83,9 @@ struct scsi_device {
 	unsigned short queue_depth;	/* How deep of a queue we want */
 	unsigned short last_queue_full_depth; /* These two are used by */
 	unsigned short last_queue_full_count; /* scsi_track_queue_full() */
-	unsigned long last_queue_full_time;/* don't let QUEUE_FULLs on the same
-					   jiffie count on our counter, they
-					   could all be from the same event. */
+	unsigned long last_queue_full_time;	/* last queue full time */
+	unsigned long queue_ramp_up_period;	/* ramp up period in jiffies */
+	unsigned long last_queue_ramp_up;	/* last queue ramp up time */
 
 	unsigned int id, lun, channel;
 


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

* [RFC PATCH 6/9] scsi: adds sdev->queue_ramp_up_period to sysfs
  2009-08-26 18:03 [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c Vasu Dev
                   ` (4 preceding siblings ...)
  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
  2009-08-26 18:03 ` [RFC PATCH 7/9] scsi: add common queue_depth ramp up code Vasu Dev
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Vasu Dev @ 2009-08-26 18:03 UTC (permalink / raw)
  To: michaelc, linux-scsi

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;


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

* [RFC PATCH 7/9] scsi: add common queue_depth ramp up code
  2009-08-26 18:03 [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c Vasu Dev
                   ` (5 preceding siblings ...)
  2009-08-26 18:03 ` [RFC PATCH 6/9] scsi: adds sdev->queue_ramp_up_period to sysfs Vasu Dev
@ 2009-08-26 18:03 ` 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
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Vasu Dev @ 2009-08-26 18:03 UTC (permalink / raw)
  To: michaelc, linux-scsi

Adds scsi_handle_queue_ramp_up to ramp up queue_depth on
successful completion of IO. The scsi_handle_queue_ramp_up
will do ramp up on all luns of a target, just same as
ramp down done on all luns on a target.

However ramp up is skipped if lapsed time since either
last queue ramp up or down is less than LLD specified
queue_ramp_up_period.

The ramp up is also skipped in case the change_queue_depth
is not supported by LLD.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---

 drivers/scsi/scsi_error.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 7d1b862..08490c7 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -331,6 +331,42 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
 	}
 }
 
+static void scsi_handle_queue_ramp_up(struct scsi_device *sdev)
+{
+	struct scsi_host_template *sht = sdev->host->hostt;
+	struct scsi_device *tmp_sdev;
+
+	if (!sht->change_queue_depth)
+		return;
+
+	if (time_before(jiffies,
+	    sdev->last_queue_ramp_up + sdev->queue_ramp_up_period))
+		return;
+
+	if (time_before(jiffies,
+	    sdev->last_queue_full_time + sdev->queue_ramp_up_period))
+		return;
+
+	/*
+	 * Walk all devices of a target and do
+	 * ramp up on them.
+	 */
+	shost_for_each_device(tmp_sdev, sdev->host) {
+		if ((tmp_sdev->channel != sdev->channel) ||
+		    (tmp_sdev->id != sdev->id))
+			continue;
+		/*
+		 * We do not know max queue_depth supported by the
+		 * device, so pass the existing queue_depth and let
+		 * device adjust the queue_depth on ramp up change
+		 * event.
+		 */
+		sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth,
+					SCSI_QDEPTH_RAMP_UP);
+		sdev->last_queue_ramp_up = jiffies;
+	}
+}
+
 static void scsi_handle_queue_full(struct scsi_device *sdev)
 {
 	struct scsi_host_template *sht = sdev->host->hostt;
@@ -392,6 +428,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
 	 */
 	switch (status_byte(scmd->result)) {
 	case GOOD:
+		scsi_handle_queue_ramp_up(scmd->device);
 	case COMMAND_TERMINATED:
 		return SUCCESS;
 	case CHECK_CONDITION:
@@ -1421,6 +1458,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
 		 */
 		return ADD_TO_MLQUEUE;
 	case GOOD:
+		scsi_handle_queue_ramp_up(scmd->device);
 	case COMMAND_TERMINATED:
 		return SUCCESS;
 	case TASK_ABORTED:


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

* [RFC PATCH 8/9] fcoe, libfc: fix an libfc issue with queue ramp down in libfc
  2009-08-26 18:03 [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c Vasu Dev
                   ` (6 preceding siblings ...)
  2009-08-26 18:03 ` [RFC PATCH 7/9] scsi: add common queue_depth ramp up code Vasu Dev
@ 2009-08-26 18:03 ` Vasu Dev
  2009-08-26 18:04 ` [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc 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
  9 siblings, 0 replies; 25+ messages in thread
From: Vasu Dev @ 2009-08-26 18:03 UTC (permalink / raw)
  To: michaelc, linux-scsi

The cmd_per_lun value is used by scsi-ml as fall back lowest
queue_depth value but in case of libfc cmd_per_lun is set to
same value as max queue_depth = 32.

So this patch reduces cmd_per_lun value to 3 and configures
each lun with default max queue_depth 32 in fc_slave_alloc.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---

 drivers/scsi/fcoe/fcoe.c    |    2 +-
 drivers/scsi/libfc/fc_fcp.c |   14 ++++++--------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 704b8e0..64fd867 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -137,7 +137,7 @@ static struct scsi_host_template fcoe_shost_template = {
 	.change_queue_depth = fc_change_queue_depth,
 	.change_queue_type = fc_change_queue_type,
 	.this_id = -1,
-	.cmd_per_lun = 32,
+	.cmd_per_lun = 3,
 	.can_queue = FCOE_MAX_OUTSTANDING_COMMANDS,
 	.use_clustering = ENABLE_CLUSTERING,
 	.sg_tablesize = SG_ALL,
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 4037685..dda4162 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2031,18 +2031,16 @@ EXPORT_SYMBOL(fc_eh_host_reset);
 int fc_slave_alloc(struct scsi_device *sdev)
 {
 	struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
-	int queue_depth;
 
 	if (!rport || fc_remote_port_chkready(rport))
 		return -ENXIO;
 
-	if (sdev->tagged_supported) {
-		if (sdev->host->hostt->cmd_per_lun)
-			queue_depth = sdev->host->hostt->cmd_per_lun;
-		else
-			queue_depth = FC_FCP_DFLT_QUEUE_DEPTH;
-		scsi_activate_tcq(sdev, queue_depth);
-	}
+	if (sdev->tagged_supported)
+		scsi_activate_tcq(sdev, FC_FCP_DFLT_QUEUE_DEPTH);
+	else
+		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
+					FC_FCP_DFLT_QUEUE_DEPTH);
+
 	return 0;
 }
 EXPORT_SYMBOL(fc_slave_alloc);


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

* [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc
  2009-08-26 18:03 [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c Vasu Dev
                   ` (7 preceding siblings ...)
  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 ` Vasu Dev
  2009-08-27 10:19   ` Christof Schmitt
  2009-09-01 22:57 ` [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c Vasu Dev
  9 siblings, 1 reply; 25+ messages in thread
From: Vasu Dev @ 2009-08-26 18:04 UTC (permalink / raw)
  To: michaelc, linux-scsi

Increases queue_depth by one on fc_change_queue_depth call back
with reason SCSI_QDEPTH_RAMP_UP.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---

 drivers/scsi/libfc/fc_fcp.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index dda4162..92e8a1b 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2054,6 +2054,11 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
 	case SCSI_QDEPTH_QFULL:
 		scsi_track_queue_full(sdev, qdepth);
 		break;
+	case SCSI_QDEPTH_RAMP_UP:
+		if (qdepth + 1 <= FC_FCP_DFLT_QUEUE_DEPTH)
+			scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
+						qdepth + 1);
+		break;
 	default:
 		return -EOPNOTSUPP;
 	}


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

* Re: [RFC PATCH 3/9] drivers: convert drivers setting the change_queue_depth callback
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Jeff Garzik @ 2009-08-26 18:19 UTC (permalink / raw)
  To: Vasu Dev; +Cc: michaelc, linux-scsi

On 08/26/2009 02:03 PM, Vasu Dev wrote:
> From: Mike Christie<michaelc@cs.wisc.edu>
>
> This is a simple port of the drivers setting a change_queue_depth
> callback but were not tracking queue fulls. In the patch I just have
> these LLDs adjust the queue depth if the user was requesting it.

Where is the doc describing how, and why, queue-full tracking occurs?


> diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
> index 86a4058..fb28be9 100644
> --- a/drivers/ata/sata_nv.c
> +++ b/drivers/ata/sata_nv.c
> @@ -1963,7 +1963,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)
>   	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
>
>   	if (strncmp(model_num, "Maxtor", 6) == 0) {
> -		ata_scsi_change_queue_depth(sdev, 1);
> +		ata_scsi_change_queue_depth(sdev, 1, SCSI_QDEPTH_SYSFS_REQ);
>   		ata_dev_printk(dev, KERN_NOTICE,
>   			"Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth);
>   	}

This queue depth change was clearly not requested via sysfs...

	Jeff




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

* Re: [RFC PATCH 3/9] drivers: convert drivers setting the change_queue_depth callback
  2009-08-26 18:19   ` Jeff Garzik
@ 2009-08-26 21:50     ` Vasu Dev
  2009-08-26 21:55       ` Mike Christie
  0 siblings, 1 reply; 25+ messages in thread
From: Vasu Dev @ 2009-08-26 21:50 UTC (permalink / raw)
  To: Jeff Garzik, michaelc; +Cc: Vasu Dev, linux-scsi

On Wed, 2009-08-26 at 14:19 -0400, Jeff Garzik wrote:
> On 08/26/2009 02:03 PM, Vasu Dev wrote:
> > From: Mike Christie<michaelc@cs.wisc.edu>
> >
> > This is a simple port of the drivers setting a change_queue_depth
> > callback but were not tracking queue fulls. In the patch I just have
> > these LLDs adjust the queue depth if the user was requesting it.
> 
> Where is the doc describing how, and why, queue-full tracking occurs?
> 

The FCP-3 sec 4.2 states "If command queueing resources are unavailable
in the logical unit when a command is received, the device server
returns TASK SET FULL status or BUSY status in the FCP_RSP IU as
specified by SAM-3". 

But this patch series is to move the QUEUE_FULL and then the ramp up
code from libfc, qla2xxx and lpfc drives to scsi-ml, the libfc had
QUEUE_FULL code to move up. This series is not to change how and why
part in current queue_full tracking and that was better described in
first RFC cover by Mike at
http://www.spinics.net/lists/linux-scsi/msg35959.html .

> 
> > diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
> > index 86a4058..fb28be9 100644
> > --- a/drivers/ata/sata_nv.c
> > +++ b/drivers/ata/sata_nv.c
> > @@ -1963,7 +1963,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)
> >   	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
> >
> >   	if (strncmp(model_num, "Maxtor", 6) == 0) {
> > -		ata_scsi_change_queue_depth(sdev, 1);
> > +		ata_scsi_change_queue_depth(sdev, 1, SCSI_QDEPTH_SYSFS_REQ);
> >   		ata_dev_printk(dev, KERN_NOTICE,
> >   			"Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth);
> >   	}
> 
> This queue depth change was clearly not requested via sysfs...
> 

Can be renamed as SCSI_QDEPTH_DEFAULT or SCSI_QDEPTH_NONE reason. What
do you think Mike ?

Added SCSI_QDEPTH_SYSFS_REQ is default reason code for other drivers
code impacted by addition of new reason parameter to existing
scsi_host_template->change_queue_depth(), then other non-FC driver
ignore any other reason code to keep their existing functionality intact
by this API change, so any generic reason name will work and Mike may
find more suitable common name for this.

	Thanks
	Vasu


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

* Re: [RFC PATCH 3/9] drivers: convert drivers setting the change_queue_depth callback
  2009-08-26 21:50     ` Vasu Dev
@ 2009-08-26 21:55       ` Mike Christie
  0 siblings, 0 replies; 25+ messages in thread
From: Mike Christie @ 2009-08-26 21:55 UTC (permalink / raw)
  To: Vasu Dev; +Cc: Jeff Garzik, Vasu Dev, linux-scsi

Vasu Dev wrote:
> On Wed, 2009-08-26 at 14:19 -0400, Jeff Garzik wrote:
>> On 08/26/2009 02:03 PM, Vasu Dev wrote:
>>> From: Mike Christie<michaelc@cs.wisc.edu>
>>>
>>> This is a simple port of the drivers setting a change_queue_depth
>>> callback but were not tracking queue fulls. In the patch I just have
>>> these LLDs adjust the queue depth if the user was requesting it.
>> Where is the doc describing how, and why, queue-full tracking occurs?
>>
> 
> The FCP-3 sec 4.2 states "If command queueing resources are unavailable
> in the logical unit when a command is received, the device server
> returns TASK SET FULL status or BUSY status in the FCP_RSP IU as
> specified by SAM-3". 
> 
> But this patch series is to move the QUEUE_FULL and then the ramp up
> code from libfc, qla2xxx and lpfc drives to scsi-ml, the libfc had
> QUEUE_FULL code to move up. This series is not to change how and why
> part in current queue_full tracking and that was better described in
> first RFC cover by Mike at
> http://www.spinics.net/lists/linux-scsi/msg35959.html .
> 
>>> diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
>>> index 86a4058..fb28be9 100644
>>> --- a/drivers/ata/sata_nv.c
>>> +++ b/drivers/ata/sata_nv.c
>>> @@ -1963,7 +1963,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)
>>>   	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
>>>
>>>   	if (strncmp(model_num, "Maxtor", 6) == 0) {
>>> -		ata_scsi_change_queue_depth(sdev, 1);
>>> +		ata_scsi_change_queue_depth(sdev, 1, SCSI_QDEPTH_SYSFS_REQ);
>>>   		ata_dev_printk(dev, KERN_NOTICE,
>>>   			"Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth);
>>>   	}
>> This queue depth change was clearly not requested via sysfs...
>>
> 
> Can be renamed as SCSI_QDEPTH_DEFAULT or SCSI_QDEPTH_NONE reason. What
> do you think Mike ?

Yes. That is better.

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

* Re: [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Christof Schmitt @ 2009-08-27 10:19 UTC (permalink / raw)
  To: Vasu Dev; +Cc: michaelc, linux-scsi

On Wed, Aug 26, 2009 at 11:04:03AM -0700, Vasu Dev wrote:
> Increases queue_depth by one on fc_change_queue_depth call back
> with reason SCSI_QDEPTH_RAMP_UP.
> 
> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
> ---
> 
>  drivers/scsi/libfc/fc_fcp.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
> index dda4162..92e8a1b 100644
> --- a/drivers/scsi/libfc/fc_fcp.c
> +++ b/drivers/scsi/libfc/fc_fcp.c
> @@ -2054,6 +2054,11 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
>  	case SCSI_QDEPTH_QFULL:
>  		scsi_track_queue_full(sdev, qdepth);
>  		break;
> +	case SCSI_QDEPTH_RAMP_UP:
> +		if (qdepth + 1 <= FC_FCP_DFLT_QUEUE_DEPTH)
> +			scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
> +						qdepth + 1);
> +		break;
>  	default:
>  		return -EOPNOTSUPP;
>  	}

Overall the approach looks good to me.

I am trying to find out how this applies to the zfcp driver. Is the
approach in fc_change_queue_depth a good example for a driver that
does not have to adjust internal resources when changing the queue
depth?

--
Christof Schmitt

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

* Re: [RFC PATCH 1/9] scsi-ml: modify change_queue_depth to take in reason why it is being called
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Christof Schmitt @ 2009-08-27 10:21 UTC (permalink / raw)
  To: Vasu Dev; +Cc: michaelc, linux-scsi

On Wed, Aug 26, 2009 at 11:03:20AM -0700, Vasu Dev wrote:
> --- a/include/scsi/scsi_host.h
> +++ b/include/scsi/scsi_host.h
> @@ -43,6 +43,13 @@ struct blk_queue_tags;
>  #define DISABLE_CLUSTERING 0
>  #define ENABLE_CLUSTERING 1
> 
> +enum {
> +	SCSI_QDEPTH_SYSFS_REQ,	/* user requested change through sysfs */
> +	SCSI_QDEPTH_QFULL,	/* scsi-ml requested due to queue full */
> +	SCSI_QDEPTH_RAMP_UP,	/* scsi-ml requested due to threshhold event */
> +	SCSI_QDEPTH_RAMP_DOWN, 	/* LLD/class requested due to lld/class event */
> +};
> +
>  struct scsi_host_template {
>  	struct module *module;
>  	const char *name;

I did not find SCSI_QDEPTH_RAMP_DOWN being used. Would a LLD use this
internally when changing the queue depth?

--
Christof Schmitt

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

* Re: [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc
  2009-08-27 10:19   ` Christof Schmitt
@ 2009-08-27 20:56     ` Vasu Dev
  2009-08-28 10:44       ` Christof Schmitt
  0 siblings, 1 reply; 25+ messages in thread
From: Vasu Dev @ 2009-08-27 20:56 UTC (permalink / raw)
  To: Christof Schmitt; +Cc: Vasu Dev, michaelc, linux-scsi

On Thu, 2009-08-27 at 12:19 +0200, Christof Schmitt wrote:
> On Wed, Aug 26, 2009 at 11:04:03AM -0700, Vasu Dev wrote:
> > Increases queue_depth by one on fc_change_queue_depth call back
> > with reason SCSI_QDEPTH_RAMP_UP.
> > 
> > Signed-off-by: Vasu Dev <vasu.dev@intel.com>
> > ---
> > 
> >  drivers/scsi/libfc/fc_fcp.c |    5 +++++
> >  1 files changed, 5 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
> > index dda4162..92e8a1b 100644
> > --- a/drivers/scsi/libfc/fc_fcp.c
> > +++ b/drivers/scsi/libfc/fc_fcp.c
> > @@ -2054,6 +2054,11 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
> >  	case SCSI_QDEPTH_QFULL:
> >  		scsi_track_queue_full(sdev, qdepth);
> >  		break;
> > +	case SCSI_QDEPTH_RAMP_UP:
> > +		if (qdepth + 1 <= FC_FCP_DFLT_QUEUE_DEPTH)
> > +			scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
> > +						qdepth + 1);
> > +		break;
> >  	default:
> >  		return -EOPNOTSUPP;
> >  	}
> 
> Overall the approach looks good to me.
> 
> I am trying to find out how this applies to the zfcp driver. Is the
> approach in fc_change_queue_depth a good example for a driver that
> does not have to adjust internal resources when changing the queue
> depth?
> 

Yes, this is the case with libfc also since libfc also doesn't make any
additional resource adjustments on this call back. However If needed
then this call back can be used to make additional resource adjustments
also as needed by lpfc driver in lpfc_change_queue_depth.

	Vasu



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

* Re: [RFC PATCH 1/9] scsi-ml: modify change_queue_depth to take in reason why it is being called
  2009-08-27 10:21   ` Christof Schmitt
@ 2009-08-27 21:09     ` Vasu Dev
  2009-08-28 16:56       ` Mike Christie
  0 siblings, 1 reply; 25+ messages in thread
From: Vasu Dev @ 2009-08-27 21:09 UTC (permalink / raw)
  To: Christof Schmitt, michaelc; +Cc: Vasu Dev, linux-scsi

On Thu, 2009-08-27 at 12:21 +0200, Christof Schmitt wrote:
> On Wed, Aug 26, 2009 at 11:03:20AM -0700, Vasu Dev wrote:
> > --- a/include/scsi/scsi_host.h
> > +++ b/include/scsi/scsi_host.h
> > @@ -43,6 +43,13 @@ struct blk_queue_tags;
> >  #define DISABLE_CLUSTERING 0
> >  #define ENABLE_CLUSTERING 1
> > 
> > +enum {
> > +	SCSI_QDEPTH_SYSFS_REQ,	/* user requested change through sysfs */
> > +	SCSI_QDEPTH_QFULL,	/* scsi-ml requested due to queue full */
> > +	SCSI_QDEPTH_RAMP_UP,	/* scsi-ml requested due to threshhold event */
> > +	SCSI_QDEPTH_RAMP_DOWN, 	/* LLD/class requested due to lld/class event */
> > +};
> > +
> >  struct scsi_host_template {
> >  	struct module *module;
> >  	const char *name;
> 
> I did not find SCSI_QDEPTH_RAMP_DOWN being used. Would a LLD use this
> internally when changing the queue depth?
> 

Yes it is not used, should be removed before final patches unless Mike
have plan to use this reason code.

	Vasu


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

* Re: [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc
  2009-08-27 20:56     ` Vasu Dev
@ 2009-08-28 10:44       ` Christof Schmitt
  2009-09-02 18:00         ` Vasu Dev
  0 siblings, 1 reply; 25+ messages in thread
From: Christof Schmitt @ 2009-08-28 10:44 UTC (permalink / raw)
  To: Vasu Dev; +Cc: michaelc, linux-scsi

On Thu, Aug 27, 2009 at 01:56:31PM -0700, Vasu Dev wrote:
> On Thu, 2009-08-27 at 12:19 +0200, Christof Schmitt wrote:
> > On Wed, Aug 26, 2009 at 11:04:03AM -0700, Vasu Dev wrote:
> > > Increases queue_depth by one on fc_change_queue_depth call back
> > > with reason SCSI_QDEPTH_RAMP_UP.
> > > 
> > > Signed-off-by: Vasu Dev <vasu.dev@intel.com>
> > > ---
> > > 
> > >  drivers/scsi/libfc/fc_fcp.c |    5 +++++
> > >  1 files changed, 5 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
> > > index dda4162..92e8a1b 100644
> > > --- a/drivers/scsi/libfc/fc_fcp.c
> > > +++ b/drivers/scsi/libfc/fc_fcp.c
> > > @@ -2054,6 +2054,11 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
> > >  	case SCSI_QDEPTH_QFULL:
> > >  		scsi_track_queue_full(sdev, qdepth);
> > >  		break;
> > > +	case SCSI_QDEPTH_RAMP_UP:
> > > +		if (qdepth + 1 <= FC_FCP_DFLT_QUEUE_DEPTH)
> > > +			scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
> > > +						qdepth + 1);
> > > +		break;
> > >  	default:
> > >  		return -EOPNOTSUPP;
> > >  	}
> > 
> > Overall the approach looks good to me.
> > 
> > I am trying to find out how this applies to the zfcp driver. Is the
> > approach in fc_change_queue_depth a good example for a driver that
> > does not have to adjust internal resources when changing the queue
> > depth?
> > 
> 
> Yes, this is the case with libfc also since libfc also doesn't make any
> additional resource adjustments on this call back. However If needed
> then this call back can be used to make additional resource adjustments
> also as needed by lpfc driver in lpfc_change_queue_depth.

There are also no resource adjustments necessary inside the zfcp
driver, i attached a first patch to adapt the zfcp change_queue_depth
callback.

I reused the default_depth settings for checking the maximum queue
depth. But i am wondering if the check should happen differently.
Would it make more sense to have an adjustable maximum_depth attribute
for each SCSI device? Or would it be possible to always increase the
queue depth until the storage returns QUEUE_FULL again?

Christof

---
zfcp: Adapt change_queue_depth for queue full tracking

From: Christof Schmitt <christof.schmitt@de.ibm.com>

Adapt the change_queue_depth callback in zfcp for the new reason
parameter. Simply pass each call back to the SCSI midlayer, there are
no resource adjustments necessary for zfcp.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
---
 drivers/s390/scsi/zfcp_scsi.c |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

--- a/drivers/s390/scsi/zfcp_scsi.c	2009-08-28 12:00:12.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_scsi.c	2009-08-28 12:01:27.000000000 +0200
@@ -28,9 +28,25 @@ char *zfcp_get_fcp_sns_info_ptr(struct f
 	return fcp_sns_info_ptr;
 }
 
-static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth)
+static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth,
+					int reason)
 {
-	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
+	switch (reason) {
+	case SCSI_QDEPTH_SYSFS_REQ:
+		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
+		break;
+	case SCSI_QDEPTH_QFULL:
+		scsi_track_queue_full(sdev, depth);
+		break;
+	case SCSI_QDEPTH_RAMP_UP:
+		depth++;
+		if (depth <= default_depth)
+			scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
+						depth);
+		break;
+	default:
+		return -EOPNOTSUPP;
+	}
 	return sdev->queue_depth;
 }
 

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

* Re: [RFC PATCH 1/9] scsi-ml: modify change_queue_depth to take in reason why it is being called
  2009-08-27 21:09     ` Vasu Dev
@ 2009-08-28 16:56       ` Mike Christie
  0 siblings, 0 replies; 25+ messages in thread
From: Mike Christie @ 2009-08-28 16:56 UTC (permalink / raw)
  To: Vasu Dev; +Cc: Christof Schmitt, Vasu Dev, linux-scsi

Vasu Dev wrote:
> On Thu, 2009-08-27 at 12:21 +0200, Christof Schmitt wrote:
>> On Wed, Aug 26, 2009 at 11:03:20AM -0700, Vasu Dev wrote:
>>> --- a/include/scsi/scsi_host.h
>>> +++ b/include/scsi/scsi_host.h
>>> @@ -43,6 +43,13 @@ struct blk_queue_tags;
>>>  #define DISABLE_CLUSTERING 0
>>>  #define ENABLE_CLUSTERING 1
>>>
>>> +enum {
>>> +	SCSI_QDEPTH_SYSFS_REQ,	/* user requested change through sysfs */
>>> +	SCSI_QDEPTH_QFULL,	/* scsi-ml requested due to queue full */
>>> +	SCSI_QDEPTH_RAMP_UP,	/* scsi-ml requested due to threshhold event */
>>> +	SCSI_QDEPTH_RAMP_DOWN, 	/* LLD/class requested due to lld/class event */
>>> +};
>>> +
>>>  struct scsi_host_template {
>>>  	struct module *module;
>>>  	const char *name;
>> I did not find SCSI_QDEPTH_RAMP_DOWN being used. Would a LLD use this
>> internally when changing the queue depth?
>>
> 
> Yes it is not used, should be removed before final patches unless Mike
> have plan to use this reason code.
> 

It might have been a goof up on my part. It is not needed.

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

* Re: [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c
  2009-08-26 18:03 [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c Vasu Dev
                   ` (8 preceding siblings ...)
  2009-08-26 18:04 ` [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc Vasu Dev
@ 2009-09-01 22:57 ` Vasu Dev
  2009-09-02  1:46   ` Mike Christie
  9 siblings, 1 reply; 25+ messages in thread
From: Vasu Dev @ 2009-09-01 22:57 UTC (permalink / raw)
  To: michaelc; +Cc: linux-scsi

On Wed, 2009-08-26 at 11:03 -0700, Vasu Dev wrote:
> First four patches are from Mike Christie's original RFC at:-
> 
> http://www.spinics.net/lists/linux-scsi/msg35959.html
> http://www.spinics.net/lists/linux-scsi/msg35962.html
> http://www.spinics.net/lists/linux-scsi/msg35961.html
> http://www.spinics.net/lists/linux-scsi/msg35963.html
> http://www.spinics.net/lists/linux-scsi/msg35964.html
> 
> Above four patches adds ramp down code and I appended ramp
> up code in following patches and tested this entire
> series with libfc/fcoe. This series works fine without any
> regression and also queue_depth adjustment works for both
> ramp down and ramp up.
> 
> Above patches are updated to scsi-misc -rc7 plus recently
> submitted 64 fcoe patches series by Rob
> "[PATCH 00/64] libfc, libfcoe and fcoe updates for scsi-misc"
> This series also applies cleanly to scsi-misc -rc7.
> 
> I'd appreciate review comments for added more patches for
> ramp up.
> 
> I'll post my final patches to this list skipping fcoe list,
> this as per Rob Love suggestion since mostly scsi changes
> by this series beyond fcoe/libfc. However Rob agreed to
> review/Ack fcoe/libfc changes at this list.
> 
> Mike, I'll be able to post my ramp up patches only once
> you send final patches for ramp down on which my patches
> depends. As I said your patches are tested for libfc,
> so most common code is already tested and they are
> good go as far as libfc goes.
> 

Hey Mike, 

	I'd like to get final patches of this series out this week to
get them into next merge window but not sure how to get final patches
out with your first four RFC patches in this series on which rest all
patches depends. Please help me on this.

I see following ways to get final patches out:-

 1. You post your first four as final patches and then I post mine.

 2. I've tested this series for libfc, so I can trim your patches to
only scsi-ml and libfc changes excluding lpfc and qla changes for now
since this is all I can test before I send out final patches. I suppose
it should be okay to post your RFC patches by me with my verification
with libfc and your approval as these RFC patches author.

	Let me know which way you would like to proceed, In any case patches
needs to be updated for recent comments.

	Thanks
	Vasu
> 
> ---
> 
> Mike Christie (4):
>       drivers: convert fc drivers calling scsi_track_queue_full
>       drivers: convert drivers setting the change_queue_depth callback
>       scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL
>       scsi-ml: modify change_queue_depth to take in reason why it is being called
> 
> Vasu Dev (5):
>       libfc: adds queue_depth ramp up to libfc
>       fcoe, libfc: fix an libfc issue with queue ramp down in libfc
>       scsi: add common queue_depth ramp up code
>       scsi: adds sdev->queue_ramp_up_period to sysfs
>       scsi: updates sdev to add queue_depth ramp up code
> 

> 


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

* Re: [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Mike Christie @ 2009-09-02  1:46 UTC (permalink / raw)
  To: Vasu Dev; +Cc: linux-scsi

On 09/01/2009 05:57 PM, Vasu Dev wrote:
> On Wed, 2009-08-26 at 11:03 -0700, Vasu Dev wrote:
>> First four patches are from Mike Christie's original RFC at:-
>>
>> http://www.spinics.net/lists/linux-scsi/msg35959.html
>> http://www.spinics.net/lists/linux-scsi/msg35962.html
>> http://www.spinics.net/lists/linux-scsi/msg35961.html
>> http://www.spinics.net/lists/linux-scsi/msg35963.html
>> http://www.spinics.net/lists/linux-scsi/msg35964.html
>>
>> Above four patches adds ramp down code and I appended ramp
>> up code in following patches and tested this entire
>> series with libfc/fcoe. This series works fine without any
>> regression and also queue_depth adjustment works for both
>> ramp down and ramp up.
>>
>> Above patches are updated to scsi-misc -rc7 plus recently
>> submitted 64 fcoe patches series by Rob
>> "[PATCH 00/64] libfc, libfcoe and fcoe updates for scsi-misc"
>> This series also applies cleanly to scsi-misc -rc7.
>>
>> I'd appreciate review comments for added more patches for
>> ramp up.
>>
>> I'll post my final patches to this list skipping fcoe list,
>> this as per Rob Love suggestion since mostly scsi changes
>> by this series beyond fcoe/libfc. However Rob agreed to
>> review/Ack fcoe/libfc changes at this list.
>>
>> Mike, I'll be able to post my ramp up patches only once
>> you send final patches for ramp down on which my patches
>> depends. As I said your patches are tested for libfc,
>> so most common code is already tested and they are
>> good go as far as libfc goes.
>>
>
> Hey Mike,
>
> 	I'd like to get final patches of this series out this week to
> get them into next merge window but not sure how to get final patches
> out with your first four RFC patches in this series on which rest all
> patches depends. Please help me on this.
>



You should just post your patches with mine. I do not have time to test 
my stuff right now with the current kernel, and since you need them and 
are going to have to test your patches just make it easy for 
James/reviewers and send it all in one patchset so people do not have to 
search for dependencies.

For my patches just add your signed off after mine, since you are 
sending them and I had written them.

You can/should probably also pick up Christop's stuff too for him (zfcp 
patches).

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

* Re: [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc
  2009-08-28 10:44       ` Christof Schmitt
@ 2009-09-02 18:00         ` Vasu Dev
  0 siblings, 0 replies; 25+ messages in thread
From: Vasu Dev @ 2009-09-02 18:00 UTC (permalink / raw)
  To: Christof Schmitt; +Cc: michaelc, linux-scsi

On Fri, 2009-08-28 at 12:44 +0200, Christof Schmitt wrote:
> On Thu, Aug 27, 2009 at 01:56:31PM -0700, Vasu Dev wrote:

<snip>
> 
> I reused the default_depth settings for checking the maximum queue
> depth. But i am wondering if the check should happen differently.
> Would it make more sense to have an adjustable maximum_depth attribute
> for each SCSI device? Or would it be possible to always increase the
> queue depth until the storage returns QUEUE_FULL again?

Increasing only up to initially configured maximum_depth by LLD is
required otherwise there won't be any upper bound on qdepth increase and
in case of no traffic the qdepth will keep on increasing since there
won't be any QUEUE_FULL event in that case and that might lead to other
issues with qdepth related other resources in the stack.

Currently scsi-ml is not aware of maximum_depth but as you suggested
above it can be added to each scsi_device and then common scsi-ml ramp
up code can ramp up up to configured maximum_depth. But that would
require adding maximum_depth field to scsi_device for only ramp up
purpose and given ramp up call back is required for LLD requiring their
additional resources adjustment I had LLD checked for maximum_depth.

However I think moving qdepth increment qdepth++ to scsi-ml common ramp
up code will eliminate increment in each LLD. I'll do that move.

	Thanks
	Vasu

> ---
> zfcp: Adapt change_queue_depth for queue full tracking
> 
> From: Christof Schmitt <christof.schmitt@de.ibm.com>
> 
> Adapt the change_queue_depth callback in zfcp for the new reason
> parameter. Simply pass each call back to the SCSI midlayer, there are
> no resource adjustments necessary for zfcp.
> 
> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
> ---
>  drivers/s390/scsi/zfcp_scsi.c |   20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> --- a/drivers/s390/scsi/zfcp_scsi.c	2009-08-28 12:00:12.000000000 +0200
> +++ b/drivers/s390/scsi/zfcp_scsi.c	2009-08-28 12:01:27.000000000 +0200
> @@ -28,9 +28,25 @@ char *zfcp_get_fcp_sns_info_ptr(struct f
>  	return fcp_sns_info_ptr;
>  }
>  
> -static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth)
> +static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth,
> +					int reason)
>  {
> -	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
> +	switch (reason) {
> +	case SCSI_QDEPTH_SYSFS_REQ:
> +		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
> +		break;
> +	case SCSI_QDEPTH_QFULL:
> +		scsi_track_queue_full(sdev, depth);
> +		break;
> +	case SCSI_QDEPTH_RAMP_UP:
> +		depth++;
> +		if (depth <= default_depth)
> +			scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
> +						depth);
> +		break;
> +	default:
> +		return -EOPNOTSUPP;
> +	}
>  	return sdev->queue_depth;
>  }
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c
  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
  0 siblings, 2 replies; 25+ messages in thread
From: Vasu Dev @ 2009-09-02 18:01 UTC (permalink / raw)
  To: Mike Christie, Christof Schmitt; +Cc: linux-scsi

On Tue, 2009-09-01 at 20:46 -0500, Mike Christie wrote:
> On 09/01/2009 05:57 PM, Vasu Dev wrote:

<snip>

> You should just post your patches with mine. I do not have time to test 
> my stuff right now with the current kernel, and since you need them and 
> are going to have to test your patches just make it easy for 
> James/reviewers and send it all in one patchset so people do not have to 
> search for dependencies.
> 
> For my patches just add your signed off after mine, since you are 
> sending them and I had written them.

I'll get them out as per by your suggestions above, thanks.

> 
> You can/should probably also pick up Christop's stuff too for him (zfcp 
> patches).

Christof, I'm fine picking up your patch also, let me know if that is
not fine with you.

	Thanks
	Vasu



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

* Re: [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c
  2009-09-02 18:01     ` Vasu Dev
@ 2009-09-03  8:17       ` Swen Schillig
  2009-09-14 11:21       ` Christof Schmitt
  1 sibling, 0 replies; 25+ messages in thread
From: Swen Schillig @ 2009-09-03  8:17 UTC (permalink / raw)
  To: Vasu Dev; +Cc: Mike Christie, Christof Schmitt, linux-scsi

On Wed, 2009-09-02 at 11:01 -0700, Vasu Dev wrote:
> On Tue, 2009-09-01 at 20:46 -0500, Mike Christie wrote:
> > On 09/01/2009 05:57 PM, Vasu Dev wrote:
> 
> <snip>
> 
> > You should just post your patches with mine. I do not have time to test 
> > my stuff right now with the current kernel, and since you need them and 
> > are going to have to test your patches just make it easy for 
> > James/reviewers and send it all in one patchset so people do not have to 
> > search for dependencies.
> > 
> > For my patches just add your signed off after mine, since you are 
> > sending them and I had written them.
> 
> I'll get them out as per by your suggestions above, thanks.
> 
> > 
> > You can/should probably also pick up Christop's stuff too for him (zfcp 
> > patches).
> 
> Christof, I'm fine picking up your patch also, let me know if that is
> not fine with you.

Christof is currently on vacation, but I'm pretty sure he doesn't mind.
Please go ahead.

Cheers Swen
> 
> 	Thanks
> 	Vasu
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: [RFC PATCH 0/9] RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c
  2009-09-02 18:01     ` Vasu Dev
  2009-09-03  8:17       ` Swen Schillig
@ 2009-09-14 11:21       ` Christof Schmitt
  1 sibling, 0 replies; 25+ messages in thread
From: Christof Schmitt @ 2009-09-14 11:21 UTC (permalink / raw)
  To: Vasu Dev; +Cc: Mike Christie, linux-scsi

On Wed, Sep 02, 2009 at 11:01:17AM -0700, Vasu Dev wrote:
> > You can/should probably also pick up Christop's stuff too for him (zfcp 
> > patches).
> 
> Christof, I'm fine picking up your patch also, let me know if that is
> not fine with you.

Pick up the patch, that is ok with me. I guess it makes most sense to
apply this in one run.

I have not seen the patches in scsi-misc yet. Will this go into 2.6.32?

--
Christof

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

end of thread, other threads:[~2009-09-14 11:20 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [RFC PATCH 6/9] scsi: adds sdev->queue_ramp_up_period to sysfs Vasu Dev
2009-08-26 18:03 ` [RFC PATCH 7/9] scsi: add common queue_depth ramp up code 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

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.