All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/7] scsi-ml: modify change_queue_depth to take in reason why it is being called
@ 2009-10-16  0:46 Vasu Dev
       [not found] ` <20091016004639.22451.76363.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Vasu Dev @ 2009-10-16  0:46 UTC (permalink / raw)
  To: linux-scsi-u79uwXL29TY76Z2rM5mHXA, devel-s9riP+hp16TNLxjTenLetw,
	James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	michaelc-hcNo3dDEHLuVc3sceRu5cw,
	christof.schmitt-tA70FqPdS9bQT0dZR+AlfA

From: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>

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.

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

Signed-off-by: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>

-v2
	Also converted pmcraid_change_queue_depth and then verified
all modules compile  using "make allmodconfig" for any new build
warnings on X86_64.

	Updated original description after combing two original
patches from Mike to make this patch git bisectable.

Signed-off-by: Vasu Dev <vasu.dev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

 drivers/ata/libata-scsi.c             |    7 ++++++-
 drivers/ata/sata_nv.c                 |    2 +-
 drivers/message/fusion/mptscsih.c     |    9 +++++++--
 drivers/message/fusion/mptscsih.h     |    3 ++-
 drivers/s390/scsi/zfcp_scsi.c         |    6 +++++-
 drivers/scsi/3w-9xxx.c                |    6 +++++-
 drivers/scsi/3w-xxxx.c                |    6 +++++-
 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/libfc/fc_fcp.c           |    5 ++++-
 drivers/scsi/libiscsi.c               |    5 ++++-
 drivers/scsi/libsas/sas_scsi_host.c   |    6 +++++-
 drivers/scsi/megaraid/megaraid_mbox.c |    7 ++++++-
 drivers/scsi/mpt2sas/mpt2sas_scsih.c  |   10 +++++++---
 drivers/scsi/pmcraid.c                |    7 ++++++-
 drivers/scsi/qla2xxx/qla_os.c         |    7 +++++--
 drivers/scsi/scsi_sysfs.c             |    3 ++-
 include/linux/libata.h                |    2 +-
 include/scsi/libfc.h                  |    2 +-
 include/scsi/libiscsi.h               |    3 ++-
 include/scsi/libsas.h                 |    3 ++-
 include/scsi/scsi_host.h              |    8 +++++++-
 27 files changed, 118 insertions(+), 31 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index b4ee28d..5d52c2f 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1208,6 +1208,7 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
  *	ata_scsi_change_queue_depth - SCSI callback for queue depth config
  *	@sdev: SCSI device to configure queue depth for
  *	@queue_depth: new queue depth
+ *	@reason: calling context
  *
  *	This is libata standard hostt->change_queue_depth callback.
  *	SCSI will call into this callback when user tries to set queue
@@ -1219,12 +1220,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_DEFAULT)
+		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..9bb4afb 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_DEFAULT);
 		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 f68ec48..5775275 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2351,11 +2351,12 @@ mptscsih_slave_destroy(struct scsi_device *sdev)
  *	mptscsih_change_queue_depth - This function will set a devices queue depth
  *	@sdev: per scsi_device pointer
  *	@qdepth: requested queue depth
+ *	@reason: calling context
  *
  *	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;
@@ -2367,6 +2368,9 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
 	starget = scsi_target(sdev);
 	vtarget = starget->hostdata;
 
+	if (reason != SCSI_QDEPTH_DEFAULT)
+		return -EOPNOTSUPP;
+
 	if (ioc->bus_type == SPI) {
 		if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES))
 			max_depth = 1;
@@ -2433,7 +2437,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_DEFAULT);
 	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/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 0e1a346..ad11547 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -29,8 +29,12 @@ char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *fcp_rsp_iu)
 	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)
 {
+	if (reason != SCSI_QDEPTH_DEFAULT)
+		return -EOPNOTSUPP;
+
 	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
 	return sdev->queue_depth;
 }
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 36c21b1..2d16d49 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -186,8 +186,12 @@ 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_DEFAULT)
+		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 4e91650..245aeb7 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -521,8 +521,12 @@ 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_DEFAULT)
+		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..a5a493d 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_DEFAULT)
+		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..e9373a2 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_DEFAULT)
+		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..47d5d19 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_DEFAULT)
+		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 a0e7e71..901a3da 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -861,10 +861,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_DEFAULT)
+		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..07e2e35 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_DEFAULT)
+		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 d9b0e9d..e475b79 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1637,12 +1637,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_DEFAULT)
+		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..d40d5c7 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_DEFAULT)
+		return -EOPNOTSUPP;
+
 	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
 	res = (struct ipr_resource_entry *)sdev->hostdata;
 
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 59a4408..958788f 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2062,8 +2062,11 @@ 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)
 {
+	if (reason != SCSI_QDEPTH_DEFAULT)
+		return -EOPNOTSUPP;
+
 	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
 	return sdev->queue_depth;
 }
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index f1a4246..67d0f3f 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1643,8 +1643,11 @@ fault:
 }
 EXPORT_SYMBOL_GPL(iscsi_queuecommand);
 
-int iscsi_change_queue_depth(struct scsi_device *sdev, int depth)
+int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
 {
+	if (reason != SCSI_QDEPTH_DEFAULT)
+		return -EOPNOTSUPP;
+
 	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
 	return sdev->queue_depth;
 }
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 1c558d3..14b1319 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_DEFAULT)
+		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..fd181c2 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_DEFAULT)
+		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 8dc682f..55ee014 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -1099,11 +1099,12 @@ _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;
@@ -1114,6 +1115,9 @@ _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
 	struct _sas_device *sas_device;
 	unsigned long flags;
 
+	if (reason != SCSI_QDEPTH_DEFAULT)
+		return -EOPNOTSUPP;
+
 	max_depth = shost->can_queue;
 
 	/* limit max device queue for SATA to 32 */
@@ -1569,7 +1573,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_DEFAULT);
 		return 0;
 	}
 
@@ -1615,7 +1619,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_DEFAULT);
 
 	if (ssp_target)
 		sas_read_port_mode_page(sdev);
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index f7c70e2..86d158e 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -278,12 +278,17 @@ static void pmcraid_slave_destroy(struct scsi_device *scsi_dev)
  * pmcraid_change_queue_depth - Change the device's queue depth
  * @scsi_dev: scsi device struct
  * @depth: depth to set
+ * @reason: calling context
  *
  * Return value
  * 	actual depth set
  */
-static int pmcraid_change_queue_depth(struct scsi_device *scsi_dev, int depth)
+static int pmcraid_change_queue_depth(struct scsi_device *scsi_dev, int depth,
+				      int reason)
 {
+	if (reason != SCSI_QDEPTH_DEFAULT)
+		return -EOPNOTSUPP;
+
 	if (depth > PMCRAID_MAX_CMD_PER_LUN)
 		depth = PMCRAID_MAX_CMD_PER_LUN;
 
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index b79fca7..921054d 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 = {
@@ -1234,8 +1234,11 @@ qla2xxx_slave_destroy(struct scsi_device *sdev)
 }
 
 static int
-qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth)
+qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
 {
+	if (reason != SCSI_QDEPTH_DEFAULT)
+		return -EOPNOTSUPP;
+
 	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
 	return sdev->queue_depth;
 }
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index fde5453..4c59336 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_DEFAULT);
 	if (retval < 0)
 		return retval;
 
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 8769864..85df383 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1023,7 +1023,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/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.
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index a72edd4..2db2bc2 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -333,7 +333,8 @@ struct iscsi_host {
 /*
  * scsi host template
  */
-extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth);
+extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth,
+				    int reason);
 extern int iscsi_eh_abort(struct scsi_cmnd *sc);
 extern int iscsi_eh_target_reset(struct scsi_cmnd *sc);
 extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
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 *,
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 6e728b1..603054d 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -43,6 +43,12 @@ struct blk_queue_tags;
 #define DISABLE_CLUSTERING 0
 #define ENABLE_CLUSTERING 1
 
+enum {
+	SCSI_QDEPTH_DEFAULT,	/* default requested change, e.g. from sysfs */
+	SCSI_QDEPTH_QFULL,	/* scsi-ml requested due to queue full */
+	SCSI_QDEPTH_RAMP_UP,	/* scsi-ml requested due to threshhold event */
+};
+
 struct scsi_host_template {
 	struct module *module;
 	const char *name;
@@ -294,7 +300,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] 23+ messages in thread

* [PATCH v2 2/7] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL
       [not found] ` <20091016004639.22451.76363.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
@ 2009-10-16  0:46   ` Vasu Dev
  2009-10-16  0:46   ` [PATCH v2 3/7] libfc: convert libfc calling scsi_track_queue_full Vasu Dev
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 23+ messages in thread
From: Vasu Dev @ 2009-10-16  0:46 UTC (permalink / raw)
  To: linux-scsi-u79uwXL29TY76Z2rM5mHXA, devel-s9riP+hp16TNLxjTenLetw,
	James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	michaelc-hcNo3dDEHLuVc3sceRu5cw,
	christof.schmitt-tA70FqPdS9bQT0dZR+AlfA

From: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>

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-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>

-v2
Limits change_queue_depth to only all luns of target by adding
channel check while iterating for all luns of Scsi_Host. This is
same as currently qla2xxx FC HBA does on QUEUE_FULL event.

Signed-off-by: Vasu Dev <vasu.dev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

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

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 1b0060b..7b1e20f 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -331,6 +331,28 @@ 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->channel != sdev->channel ||
+		    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 +409,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;
 	}
@@ -1387,6 +1411,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] 23+ messages in thread

* [PATCH v2 3/7] libfc: convert libfc calling scsi_track_queue_full
       [not found] ` <20091016004639.22451.76363.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
  2009-10-16  0:46   ` [PATCH v2 2/7] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL Vasu Dev
@ 2009-10-16  0:46   ` Vasu Dev
  2009-10-16  0:46   ` [PATCH v2 4/7] fcoe, libfc: fix an libfc issue with queue ramp down in libfc Vasu Dev
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 23+ messages in thread
From: Vasu Dev @ 2009-10-16  0:46 UTC (permalink / raw)
  To: linux-scsi-u79uwXL29TY76Z2rM5mHXA, devel-s9riP+hp16TNLxjTenLetw,
	James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	michaelc-hcNo3dDEHLuVc3sceRu5cw,
	christof.schmitt-tA70FqPdS9bQT0dZR+AlfA

From: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>

This converts the libfc using scsi_track_queue_full to
track the queue full from the change_queue_depth callback.

Signed-off-by: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
Signed-off-by: Vasu Dev <vasu.dev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

 drivers/scsi/libfc/fc_fcp.c |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 958788f..6c189be 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
@@ -2064,10 +2049,16 @@ EXPORT_SYMBOL(fc_slave_alloc);
 
 int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
 {
-	if (reason != SCSI_QDEPTH_DEFAULT)
+	switch (reason) {
+	case SCSI_QDEPTH_DEFAULT:
+		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;
-
-	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+	}
 	return sdev->queue_depth;
 }
 EXPORT_SYMBOL(fc_change_queue_depth);

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

* [PATCH v2 4/7] fcoe, libfc: fix an libfc issue with queue ramp down in libfc
       [not found] ` <20091016004639.22451.76363.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
  2009-10-16  0:46   ` [PATCH v2 2/7] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL Vasu Dev
  2009-10-16  0:46   ` [PATCH v2 3/7] libfc: convert libfc calling scsi_track_queue_full Vasu Dev
@ 2009-10-16  0:46   ` Vasu Dev
  2009-10-16  0:47   ` [PATCH v2 5/7] scsi-ml: adds queue_depth ramp up code Vasu Dev
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 23+ messages in thread
From: Vasu Dev @ 2009-10-16  0:46 UTC (permalink / raw)
  To: linux-scsi-u79uwXL29TY76Z2rM5mHXA, devel-s9riP+hp16TNLxjTenLetw,
	James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	michaelc-hcNo3dDEHLuVc3sceRu5cw,
	christof.schmitt-tA70FqPdS9bQT0dZR+AlfA

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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

 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 6c189be..e0916fd 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] 23+ messages in thread

* [PATCH v2 5/7] scsi-ml: adds queue_depth ramp up code
       [not found] ` <20091016004639.22451.76363.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
                     ` (2 preceding siblings ...)
  2009-10-16  0:46   ` [PATCH v2 4/7] fcoe, libfc: fix an libfc issue with queue ramp down in libfc Vasu Dev
@ 2009-10-16  0:47   ` Vasu Dev
       [not found]     ` <20091016004700.22451.42962.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
                       ` (2 more replies)
  2009-10-16  0:47   ` [PATCH v2 6/7] libfc: adds queue_depth ramp up to libfc Vasu Dev
                     ` (2 subsequent siblings)
  6 siblings, 3 replies; 23+ messages in thread
From: Vasu Dev @ 2009-10-16  0:47 UTC (permalink / raw)
  To: linux-scsi-u79uwXL29TY76Z2rM5mHXA, devel-s9riP+hp16TNLxjTenLetw,
	James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	michaelc-hcNo3dDEHLuVc3sceRu5cw,
	christof.schmitt-tA70FqPdS9bQT0dZR+AlfA

Current FC HBA queue_depth ramp up code depends on last queue
full time. 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 full value and then updates its only
current usages in scsi_track_queue_full to ignore last four bits
to keep current usages same while also use this field
in added ramp up code.

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.

The ramp up is skipped in case the change_queue_depth is not
supported by LLD or already reached to added max_queue_depth.

Updates added max_queue_depth on every new update to default
queue_depth value.

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

Adds queue_ramp_up_period to sysfs but only if change_queue_depth
is supported since ramp up and queue_ramp_up_period is needed only
in case change_queue_depth is supported first.

Initializes queue_ramp_up_period to 120HZ jiffies as initial
default value, it is same as used in existing lpfc and qla2xxx.

Signed-off-by: Vasu Dev <vasu.dev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

 drivers/scsi/scsi.c        |   10 ++++++++--
 drivers/scsi/scsi_error.c  |   38 ++++++++++++++++++++++++++++++++++++++
 drivers/scsi/scsi_scan.c   |    3 +++
 drivers/scsi/scsi_sysfs.c  |   40 ++++++++++++++++++++++++++++++++++++++--
 include/scsi/scsi_device.h |    9 ++++++---
 5 files changed, 93 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index dd098ca..a60da55 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -940,10 +940,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/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 7b1e20f..3379da6 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 ||
+	    sdev->queue_depth == sdev->max_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 ||
+		    tmp_sdev->queue_depth == sdev->max_queue_depth)
+			continue;
+		/*
+		 * call back into LLD to increase queue_depth by one
+		 * with ramp up reason code.
+		 */
+		sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth + 1,
+					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;
@@ -393,6 +429,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:
@@ -1425,6 +1462,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:
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index cb6338f..2fd2c97 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;
@@ -312,6 +313,8 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 		}
 	}
 
+	sdev->max_queue_depth = sdev->queue_depth;
+
 	return sdev;
 
 out_device_destroy:
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 4c59336..bb76eb4 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -771,6 +771,8 @@ sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr,
 	if (retval < 0)
 		return retval;
 
+	sdev->max_queue_depth = sdev->queue_depth;
+
 	return count;
 }
 
@@ -779,6 +781,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 +902,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 9af48cb..92c4c3b 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -81,11 +81,14 @@ struct scsi_device {
 	struct list_head starved_entry;
 	struct scsi_cmnd *current_cmnd;	/* currently active command */
 	unsigned short queue_depth;	/* How deep of a queue we want */
+	unsigned short max_queue_depth;	/* max queue depth */
 	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 */
+#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] 23+ messages in thread

* [PATCH v2 6/7] libfc: adds queue_depth ramp up to libfc
       [not found] ` <20091016004639.22451.76363.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
                     ` (3 preceding siblings ...)
  2009-10-16  0:47   ` [PATCH v2 5/7] scsi-ml: adds queue_depth ramp up code Vasu Dev
@ 2009-10-16  0:47   ` Vasu Dev
  2009-10-16  0:47   ` [PATCH v2 7/7] zfcp: Adapt change_queue_depth for queue full tracking Vasu Dev
  2009-10-28 22:48   ` [PATCH v2 1/7] scsi-ml: modify change_queue_depth to take in reason why it is being called James Bottomley
  6 siblings, 0 replies; 23+ messages in thread
From: Vasu Dev @ 2009-10-16  0:47 UTC (permalink / raw)
  To: linux-scsi-u79uwXL29TY76Z2rM5mHXA, devel-s9riP+hp16TNLxjTenLetw,
	James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	michaelc-hcNo3dDEHLuVc3sceRu5cw,
	christof.schmitt-tA70FqPdS9bQT0dZR+AlfA

Adjust queue_depth on fc_change_queue_depth call back
with reason SCSI_QDEPTH_RAMP_UP, no additional resource
adjustments necessary for libfc.

Signed-off-by: Vasu Dev <vasu.dev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

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

diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index e0916fd..7ae20b5 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2054,6 +2054,9 @@ 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:
+		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+		break;
 	default:
 		return -EOPNOTSUPP;
 	}

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

* [PATCH v2 7/7] zfcp: Adapt change_queue_depth for queue full tracking
       [not found] ` <20091016004639.22451.76363.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
                     ` (4 preceding siblings ...)
  2009-10-16  0:47   ` [PATCH v2 6/7] libfc: adds queue_depth ramp up to libfc Vasu Dev
@ 2009-10-16  0:47   ` Vasu Dev
  2009-10-28 22:48   ` [PATCH v2 1/7] scsi-ml: modify change_queue_depth to take in reason why it is being called James Bottomley
  6 siblings, 0 replies; 23+ messages in thread
From: Vasu Dev @ 2009-10-16  0:47 UTC (permalink / raw)
  To: linux-scsi-u79uwXL29TY76Z2rM5mHXA, devel-s9riP+hp16TNLxjTenLetw,
	James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	michaelc-hcNo3dDEHLuVc3sceRu5cw,
	christof.schmitt-tA70FqPdS9bQT0dZR+AlfA

From: Christof Schmitt <christof.schmitt-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>

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-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>

Removes check for (depth <= default_depth) in case of
SCSI_QDEPTH_RAMP_UP call back, not needed after added
max_queue_depth per sdev.

Signed-off-by: Vasu Dev <vasu.dev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

 drivers/s390/scsi/zfcp_scsi.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index ad11547..f546559 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -32,10 +32,19 @@ char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *fcp_rsp_iu)
 static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth,
 					int reason)
 {
-	if (reason != SCSI_QDEPTH_DEFAULT)
+	switch (reason) {
+	case SCSI_QDEPTH_DEFAULT:
+		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:
+		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
+		break;
+	default:
 		return -EOPNOTSUPP;
-
-	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
+	}
 	return sdev->queue_depth;
 }

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

* Re: [PATCH v2 5/7] scsi-ml: adds queue_depth ramp up code
       [not found]     ` <20091016004700.22451.42962.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
@ 2009-10-16  9:29       ` Christof Schmitt
       [not found]         ` <20091016092912.GA7199-VuU8Q2ydlaqCpDFQwvYvMTJtLkR7yuzc@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Christof Schmitt @ 2009-10-16  9:29 UTC (permalink / raw)
  To: Vasu Dev
  Cc: James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	devel-s9riP+hp16TNLxjTenLetw, linux-scsi-u79uwXL29TY76Z2rM5mHXA

On Thu, Oct 15, 2009 at 05:47:00PM -0700, Vasu Dev wrote:
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 7b1e20f..3379da6 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 ||
> +	    sdev->queue_depth == sdev->max_queue_depth)
> +		return;
[...]
> --- 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;
> @@ -312,6 +313,8 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
>  		}
>  	}
> 
> +	sdev->max_queue_depth = sdev->queue_depth;
> +
>  	return sdev;

Running this patches series with the zfcp device driver increases the
queue_depth beyond the maximum. The problem is that after slave_alloc,
the queue_depth is 1 from cmd_per_lun and this is the value used for
max_queue_depth.

zfcp then adjust the queue_depth and tagging in slave_configure. Now,
the queue_depth is 32 and the max_queue_depth is still 1. And the
check for sdev->queue_depth == sdev->max_queue_depth is never true.

What is the best way to solve this? Move the initial assignment of
max_queue_depth to be called after the call to slave_configure? And/or
adjust the check above to sdev->queue_depth >= sdev->max_queue_depth?

--
Christof

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

* Re: [PATCH v2 5/7] scsi-ml: adds queue_depth ramp up code
       [not found]         ` <20091016092912.GA7199-VuU8Q2ydlaqCpDFQwvYvMTJtLkR7yuzc@public.gmane.org>
@ 2009-10-16 18:16           ` Vasu Dev
  0 siblings, 0 replies; 23+ messages in thread
From: Vasu Dev @ 2009-10-16 18:16 UTC (permalink / raw)
  To: Christof Schmitt, linux-scsi-u79uwXL29TY76Z2rM5mHXA
  Cc: James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	devel-s9riP+hp16TNLxjTenLetw

On Fri, 2009-10-16 at 11:29 +0200, Christof Schmitt wrote:
> On Thu, Oct 15, 2009 at 05:47:00PM -0700, Vasu Dev wrote:
> > diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> > index 7b1e20f..3379da6 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 ||
> > +	    sdev->queue_depth == sdev->max_queue_depth)
> > +		return;
> [...]
> > --- 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;
> > @@ -312,6 +313,8 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
> >  		}
> >  	}
> > 
> > +	sdev->max_queue_depth = sdev->queue_depth;
> > +
> >  	return sdev;
> 
> Running this patches series with the zfcp device driver increases the
> queue_depth beyond the maximum. The problem is that after slave_alloc,
> the queue_depth is 1 from cmd_per_lun and this is the value used for
> max_queue_depth.
> 

I see, I missed this case to update max_queue_depth since libfc is not
using slave_configure.

> zfcp then adjust the queue_depth and tagging in slave_configure. Now,
> the queue_depth is 32 and the max_queue_depth is still 1. And the
> check for sdev->queue_depth == sdev->max_queue_depth is never true.
> 
> What is the best way to solve this? Move the initial assignment of
> max_queue_depth to be called after the call to slave_configure? And/or

Move should work fine unless I'm missing any case where slave_configure
won't be called on new sdev alloc or max_queue_depth could change after
calling slave_configure also, apart from sysfs.

I've already added code to update this on qdepth change via sysfs. Am I
missing any other case ?

> adjust the check above to sdev->queue_depth >= sdev->max_queue_depth?
> 

Adding check this way will work as safe guard in case any place left
updating max_queue_depth but that would be bug. I'll change check as
suggested above.
	
	Thanks
	Vasu

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

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

* [PATCH v3] scsi-ml: adds queue_depth ramp up code
  2009-10-16  0:47   ` [PATCH v2 5/7] scsi-ml: adds queue_depth ramp up code Vasu Dev
       [not found]     ` <20091016004700.22451.42962.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
@ 2009-10-16 23:08     ` Vasu Dev
       [not found]       ` <20091016230824.18916.84116.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
  2009-10-22 22:46     ` [PATCH v4 5/7] " Vasu Dev
  2 siblings, 1 reply; 23+ messages in thread
From: Vasu Dev @ 2009-10-16 23:08 UTC (permalink / raw)
  To: linux-scsi, devel, James.Bottomley, michaelc, christof.schmitt

Current FC HBA queue_depth ramp up code depends on last queue
full time. 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 full value and then updates its only
current usages in scsi_track_queue_full to ignore last four bits
to keep current usages same while also use this field
in added ramp up code.

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.

The ramp up is skipped in case the change_queue_depth is not
supported by LLD or already reached to added max_queue_depth.

Updates added max_queue_depth on every new update to default
queue_depth value.

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

Adds queue_ramp_up_period to sysfs but only if change_queue_depth
is supported since ramp up and queue_ramp_up_period is needed only
in case change_queue_depth is supported first.

Initializes queue_ramp_up_period to 120HZ jiffies as initial
default value, it is same as used in existing lpfc and qla2xxx.

-v2
 Combined all ramp code into this single patch.

-v3
 Moves max_queue_depth initialization after slave_configure is
called from after slave_alloc calling done. Also adjusted
max_queue_depth check to skip ramp up if current queue_depth
is >= max_queue_depth.

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

 drivers/scsi/scsi.c        |   10 ++++++++--
 drivers/scsi/scsi_error.c  |   38 ++++++++++++++++++++++++++++++++++++++
 drivers/scsi/scsi_scan.c   |    3 +++
 drivers/scsi/scsi_sysfs.c  |   40 ++++++++++++++++++++++++++++++++++++++--
 include/scsi/scsi_device.h |    9 ++++++---
 5 files changed, 93 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index dd098ca..a60da55 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -940,10 +940,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/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 7b1e20f..08ed506 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 ||
+	    sdev->queue_depth >= sdev->max_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 ||
+		    tmp_sdev->queue_depth == sdev->max_queue_depth)
+			continue;
+		/*
+		 * call back into LLD to increase queue_depth by one
+		 * with ramp up reason code.
+		 */
+		sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth + 1,
+					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;
@@ -393,6 +429,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:
@@ -1425,6 +1462,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:
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index cb6338f..2847a86 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;
@@ -940,6 +941,8 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
 		}
 	}
 
+	sdev->max_queue_depth = sdev->queue_depth;
+
 	/*
 	 * Ok, the device is now all set up, we can
 	 * register it and tell the rest of the kernel
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 4c59336..bb76eb4 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -771,6 +771,8 @@ sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr,
 	if (retval < 0)
 		return retval;
 
+	sdev->max_queue_depth = sdev->queue_depth;
+
 	return count;
 }
 
@@ -779,6 +781,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 +902,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 9af48cb..92c4c3b 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -81,11 +81,14 @@ struct scsi_device {
 	struct list_head starved_entry;
 	struct scsi_cmnd *current_cmnd;	/* currently active command */
 	unsigned short queue_depth;	/* How deep of a queue we want */
+	unsigned short max_queue_depth;	/* max queue depth */
 	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 */
+#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] 23+ messages in thread

* Re: [PATCH v3] scsi-ml: adds queue_depth ramp up code
       [not found]       ` <20091016230824.18916.84116.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
@ 2009-10-20 18:54         ` Christof Schmitt
  2009-10-20 22:32           ` Vasu Dev
  0 siblings, 1 reply; 23+ messages in thread
From: Christof Schmitt @ 2009-10-20 18:54 UTC (permalink / raw)
  To: Vasu Dev
  Cc: James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	devel-s9riP+hp16TNLxjTenLetw, linux-scsi-u79uwXL29TY76Z2rM5mHXA

On Fri, Oct 16, 2009 at 04:08:24PM -0700, Vasu Dev wrote:
> -v3
>  Moves max_queue_depth initialization after slave_configure is
> called from after slave_alloc calling done. Also adjusted
> max_queue_depth check to skip ramp up if current queue_depth
> is >= max_queue_depth.
> 
> Signed-off-by: Vasu Dev <vasu.dev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Looks good to me. I ran some tests on s390 and the queue depth counter
increased until hitting the defined maximum.

> @@ -779,6 +781,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;
> +}

[...]
> +	unsigned long queue_ramp_up_period;	/* ramp up period in jiffies */
> +#define SCSI_DEFAULT_RAMP_UP_PERIOD	(120 * HZ)

Only a small inconvenience i guess: The sysfs attribute shows the
ramp-up-period in jiffies. On my system with HZ==100 the default is
12000 and i was wondering if this would be milliseconds or something
related. If HZ changes, the unit of the ramp-up-period also changes.

I would prefer having seconds or milliseconds in sysfs and only using
jiffies internally.

Thanks for doing this,

Christof

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

* Re: [PATCH v3] scsi-ml: adds queue_depth ramp up code
  2009-10-20 18:54         ` Christof Schmitt
@ 2009-10-20 22:32           ` Vasu Dev
  2009-10-20 23:14             ` [Open-FCoE] " Joe Eykholt
  2009-10-21 13:37             ` Michael Reed
  0 siblings, 2 replies; 23+ messages in thread
From: Vasu Dev @ 2009-10-20 22:32 UTC (permalink / raw)
  To: Christof Schmitt; +Cc: Vasu Dev, linux-scsi, devel, James.Bottomley, michaelc

On Tue, 2009-10-20 at 20:54 +0200, Christof Schmitt wrote:
> On Fri, Oct 16, 2009 at 04:08:24PM -0700, Vasu Dev wrote:
> > -v3
> >  Moves max_queue_depth initialization after slave_configure is
> > called from after slave_alloc calling done. Also adjusted
> > max_queue_depth check to skip ramp up if current queue_depth
> > is >= max_queue_depth.
> > 
> > Signed-off-by: Vasu Dev <vasu.dev@intel.com>
> 
> Looks good to me. I ran some tests on s390 and the queue depth counter
> increased until hitting the defined maximum.
> 

Good.

> > @@ -779,6 +781,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;
> > +}
> 
> [...]
> > +	unsigned long queue_ramp_up_period;	/* ramp up period in jiffies */
> > +#define SCSI_DEFAULT_RAMP_UP_PERIOD	(120 * HZ)
> 
> Only a small inconvenience i guess: The sysfs attribute shows the
> ramp-up-period in jiffies. On my system with HZ==100 the default is
> 12000 and i was wondering if this would be milliseconds or something
> related. If HZ changes, the unit of the ramp-up-period also changes.
> 
> I would prefer having seconds or milliseconds in sysfs and only using
> jiffies internally.
> 

Added timestamp comparison checks are straightforward without any
additional conversion on each check since added timestamps and
queue_ramp_up_period both are jiffies, so works better this way with
stored queue_ramp_up_period in jiffies. 

I do see your point as well but jiffies unit is also common in Linux.
However if you or some other feels strongly to change this to ms or
seconds unit then I could change store or show sysfs functions to handle
this value in ms or second unit while storing it in jiffies in
queue_ramp_up_period.

	Vasu

> Thanks for doing this,
> 
> Christof
> --
> 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] 23+ messages in thread

* Re: [Open-FCoE] [PATCH v3] scsi-ml: adds queue_depth ramp up code
  2009-10-20 22:32           ` Vasu Dev
@ 2009-10-20 23:14             ` Joe Eykholt
       [not found]               ` <4ADE444D.5090307-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
  2009-10-21 13:11               ` [Open-FCoE] " James Smart
  2009-10-21 13:37             ` Michael Reed
  1 sibling, 2 replies; 23+ messages in thread
From: Joe Eykholt @ 2009-10-20 23:14 UTC (permalink / raw)
  To: Vasu Dev; +Cc: Christof Schmitt, James.Bottomley, devel, linux-scsi

Vasu Dev wrote:
> On Tue, 2009-10-20 at 20:54 +0200, Christof Schmitt wrote:
>> On Fri, Oct 16, 2009 at 04:08:24PM -0700, Vasu Dev wrote:
>>> -v3
>>>  Moves max_queue_depth initialization after slave_configure is
>>> called from after slave_alloc calling done. Also adjusted
>>> max_queue_depth check to skip ramp up if current queue_depth
>>> is >= max_queue_depth.
>>>
>>> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
>> Looks good to me. I ran some tests on s390 and the queue depth counter
>> increased until hitting the defined maximum.
>>
> 
> Good.
> 
>>> @@ -779,6 +781,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;
>>> +}
>> [...]
>>> +	unsigned long queue_ramp_up_period;	/* ramp up period in jiffies */
>>> +#define SCSI_DEFAULT_RAMP_UP_PERIOD	(120 * HZ)
>> Only a small inconvenience i guess: The sysfs attribute shows the
>> ramp-up-period in jiffies. On my system with HZ==100 the default is
>> 12000 and i was wondering if this would be milliseconds or something
>> related. If HZ changes, the unit of the ramp-up-period also changes.
>>
>> I would prefer having seconds or milliseconds in sysfs and only using
>> jiffies internally.
>>
> 
> Added timestamp comparison checks are straightforward without any
> additional conversion on each check since added timestamps and
> queue_ramp_up_period both are jiffies, so works better this way with
> stored queue_ramp_up_period in jiffies. 
> 
> I do see your point as well but jiffies unit is also common in Linux.
> However if you or some other feels strongly to change this to ms or
> seconds unit then I could change store or show sysfs functions to handle
> this value in ms or second unit while storing it in jiffies in
> queue_ramp_up_period.
> 
> 	Vasu

I agree with Christof on this, HZ may be 100 on some machines and 1000
on others.  Management tools (if they ever adjust this) would like
standard units, so it should be in ms or seconds, and I prefer ms.
I would just change the sysfs functions as you say, and use jiffies internally.

	Joe



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

* Re: [PATCH v3] scsi-ml: adds queue_depth ramp up code
       [not found]               ` <4ADE444D.5090307-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
@ 2009-10-21  7:49                 ` Christof Schmitt
  2009-10-21 17:45                   ` [Open-FCoE] " Vasu Dev
       [not found]                   ` <20091021074944.GA3563-VuU8Q2ydlaqCpDFQwvYvMTJtLkR7yuzc@public.gmane.org>
  0 siblings, 2 replies; 23+ messages in thread
From: Christof Schmitt @ 2009-10-21  7:49 UTC (permalink / raw)
  To: Joe Eykholt
  Cc: James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, devel-s9riP+hp16TNLxjTenLetw

On Tue, Oct 20, 2009 at 04:14:21PM -0700, Joe Eykholt wrote:
> Vasu Dev wrote:
>> On Tue, 2009-10-20 at 20:54 +0200, Christof Schmitt wrote:
>>> On Fri, Oct 16, 2009 at 04:08:24PM -0700, Vasu Dev wrote:
>>>> -v3
>>>>  Moves max_queue_depth initialization after slave_configure is
>>>> called from after slave_alloc calling done. Also adjusted
>>>> max_queue_depth check to skip ramp up if current queue_depth
>>>> is >= max_queue_depth.
>>>>
>>>> Signed-off-by: Vasu Dev <vasu.dev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>>> Looks good to me. I ran some tests on s390 and the queue depth counter
>>> increased until hitting the defined maximum.
>>>
>>
>> Good.
>>
>>>> @@ -779,6 +781,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;
>>>> +}
>>> [...]
>>>> +	unsigned long queue_ramp_up_period;	/* ramp up period in jiffies */
>>>> +#define SCSI_DEFAULT_RAMP_UP_PERIOD	(120 * HZ)
>>> Only a small inconvenience i guess: The sysfs attribute shows the
>>> ramp-up-period in jiffies. On my system with HZ==100 the default is
>>> 12000 and i was wondering if this would be milliseconds or something
>>> related. If HZ changes, the unit of the ramp-up-period also changes.
>>>
>>> I would prefer having seconds or milliseconds in sysfs and only using
>>> jiffies internally.
>>>
>>
>> Added timestamp comparison checks are straightforward without any
>> additional conversion on each check since added timestamps and
>> queue_ramp_up_period both are jiffies, so works better this way with
>> stored queue_ramp_up_period in jiffies. 
>>
>> I do see your point as well but jiffies unit is also common in Linux.
>> However if you or some other feels strongly to change this to ms or
>> seconds unit then I could change store or show sysfs functions to handle
>> this value in ms or second unit while storing it in jiffies in
>> queue_ramp_up_period.
>>
>> 	Vasu
>
> I agree with Christof on this, HZ may be 100 on some machines and 1000
> on others.  Management tools (if they ever adjust this) would like
> standard units, so it should be in ms or seconds, and I prefer ms.
> I would just change the sysfs functions as you say, and use jiffies internally.

I would also vote for ms in sysfs and using jiffies internally. This
should be fairly easy using the functions jiffies_to_msecs and
msecs_to_jiffies.

Christof

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

* Re: [Open-FCoE] [PATCH v3] scsi-ml: adds queue_depth ramp up code
  2009-10-20 23:14             ` [Open-FCoE] " Joe Eykholt
       [not found]               ` <4ADE444D.5090307-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
@ 2009-10-21 13:11               ` James Smart
  1 sibling, 0 replies; 23+ messages in thread
From: James Smart @ 2009-10-21 13:11 UTC (permalink / raw)
  To: Joe Eykholt
  Cc: Vasu Dev, James.Bottomley, Christof Schmitt, devel, linux-scsi



Joe Eykholt wrote:
> Vasu Dev wrote:
>> On Tue, 2009-10-20 at 20:54 +0200, Christof Schmitt wrote:
>>> I would prefer having seconds or milliseconds in sysfs and only using
>>> jiffies internally.
>>>
>> Added timestamp comparison checks are straightforward without any
>> additional conversion on each check since added timestamps and
>> queue_ramp_up_period both are jiffies, so works better this way with
>> stored queue_ramp_up_period in jiffies. 
>>
>> I do see your point as well but jiffies unit is also common in Linux.
>> However if you or some other feels strongly to change this to ms or
>> seconds unit then I could change store or show sysfs functions to handle
>> this value in ms or second unit while storing it in jiffies in
>> queue_ramp_up_period.
>>
>> 	Vasu
> 
> I agree with Christof on this, HZ may be 100 on some machines and 1000
> on others.  Management tools (if they ever adjust this) would like
> standard units, so it should be in ms or seconds, and I prefer ms.
> I would just change the sysfs functions as you say, and use jiffies internally.
> 
> 	Joe

I'll third this request - specifying in jiffies is a non-distinct value from 
platform to platform.  ms or seconds is preferred.

-- james

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

* Re: [PATCH v3] scsi-ml: adds queue_depth ramp up code
  2009-10-20 22:32           ` Vasu Dev
  2009-10-20 23:14             ` [Open-FCoE] " Joe Eykholt
@ 2009-10-21 13:37             ` Michael Reed
  1 sibling, 0 replies; 23+ messages in thread
From: Michael Reed @ 2009-10-21 13:37 UTC (permalink / raw)
  To: Vasu Dev
  Cc: Christof Schmitt, Vasu Dev, linux-scsi, devel, James.Bottomley, michaelc



Vasu Dev wrote:
> On Tue, 2009-10-20 at 20:54 +0200, Christof Schmitt wrote:
>> On Fri, Oct 16, 2009 at 04:08:24PM -0700, Vasu Dev wrote:
>>> -v3
>>>  Moves max_queue_depth initialization after slave_configure is
>>> called from after slave_alloc calling done. Also adjusted
>>> max_queue_depth check to skip ramp up if current queue_depth
>>> is >= max_queue_depth.
>>>
>>> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
>> Looks good to me. I ran some tests on s390 and the queue depth counter
>> increased until hitting the defined maximum.
>>
> 
> Good.
> 
>>> @@ -779,6 +781,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;
>>> +}
>> [...]
>>> +	unsigned long queue_ramp_up_period;	/* ramp up period in jiffies */
>>> +#define SCSI_DEFAULT_RAMP_UP_PERIOD	(120 * HZ)
>> Only a small inconvenience i guess: The sysfs attribute shows the
>> ramp-up-period in jiffies. On my system with HZ==100 the default is
>> 12000 and i was wondering if this would be milliseconds or something
>> related. If HZ changes, the unit of the ramp-up-period also changes.
>>
>> I would prefer having seconds or milliseconds in sysfs and only using
>> jiffies internally.
>>
> 
> Added timestamp comparison checks are straightforward without any
> additional conversion on each check since added timestamps and
> queue_ramp_up_period both are jiffies, so works better this way with
> stored queue_ramp_up_period in jiffies. 
> 
> I do see your point as well but jiffies unit is also common in Linux.
> However if you or some other feels strongly to change this to ms or
> seconds unit then I could change store or show sysfs functions to handle
> this value in ms or second unit while storing it in jiffies in
> queue_ramp_up_period.

sysfs values should be presented in seconds.  jiffies is not a user accessible
unit of measure.  Esp. for systems with HZ != 100.  Milliseconds is too
fine grained (in my opinion).

Mike

> 
> 	Vasu
> 
>> Thanks for doing this,
>>
>> Christof
>> --
>> 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
> 
> --
> 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] 23+ messages in thread

* Re: [Open-FCoE] [PATCH v3] scsi-ml: adds queue_depth ramp up code
  2009-10-21  7:49                 ` Christof Schmitt
@ 2009-10-21 17:45                   ` Vasu Dev
       [not found]                   ` <20091021074944.GA3563-VuU8Q2ydlaqCpDFQwvYvMTJtLkR7yuzc@public.gmane.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Vasu Dev @ 2009-10-21 17:45 UTC (permalink / raw)
  To: Christof Schmitt; +Cc: Joe Eykholt, James.Bottomley, devel, linux-scsi

On Wed, 2009-10-21 at 09:49 +0200, Christof Schmitt wrote:
> >> Added timestamp comparison checks are straightforward without any
> >> additional conversion on each check since added timestamps and
> >> queue_ramp_up_period both are jiffies, so works better this way
> with
> >> stored queue_ramp_up_period in jiffies. 
> >>
> >> I do see your point as well but jiffies unit is also common in
> Linux.
> >> However if you or some other feels strongly to change this to ms or
> >> seconds unit then I could change store or show sysfs functions to
> handle
> >> this value in ms or second unit while storing it in jiffies in
> >> queue_ramp_up_period.
> >>
> >>      Vasu
> >
> > I agree with Christof on this, HZ may be 100 on some machines and
> 1000
> > on others.  Management tools (if they ever adjust this) would like
> > standard units, so it should be in ms or seconds, and I prefer ms.
> > I would just change the sysfs functions as you say, and use jiffies
> internally.
> 
> I would also vote for ms in sysfs and using jiffies internally. This
> should be fairly easy using the functions jiffies_to_msecs and
> msecs_to_jiffies.

Yeap it will be easy change and I'll do this change to have ms unit for
only sysfs i/f as mostly preferred ms as unit, though Mike Reed said in
other response that ms unit is too fine grained but that should be okay
as oppose to not giving choice of fine granularity and I also don't see
any risk to large value limitation by use of fine ms unit here.

I wasn't against the Christof's suggestion to use ms or sec in first
place since as I said "I do see your point as well". And now all these
responses gives solid confirmation to use ms unit here. 

Thanks all for your inputs.
 
	Vasu


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

* Re: [PATCH v3] scsi-ml: adds queue_depth ramp up code
       [not found]                   ` <20091021074944.GA3563-VuU8Q2ydlaqCpDFQwvYvMTJtLkR7yuzc@public.gmane.org>
@ 2009-10-21 17:54                     ` Giridhar Malavali
  0 siblings, 0 replies; 23+ messages in thread
From: Giridhar Malavali @ 2009-10-21 17:54 UTC (permalink / raw)
  To: Christof Schmitt
  Cc: James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, devel-s9riP+hp16TNLxjTenLetw


On Oct 21, 2009, at 12:49 AM, Christof Schmitt wrote:

> On Tue, Oct 20, 2009 at 04:14:21PM -0700, Joe Eykholt wrote:
>> Vasu Dev wrote:
>>> On Tue, 2009-10-20 at 20:54 +0200, Christof Schmitt wrote:
>>>> On Fri, Oct 16, 2009 at 04:08:24PM -0700, Vasu Dev wrote:
>>>>> -v3
>>>>> Moves max_queue_depth initialization after slave_configure is
>>>>> called from after slave_alloc calling done. Also adjusted
>>>>> max_queue_depth check to skip ramp up if current queue_depth
>>>>> is >= max_queue_depth.
>>>>>
>>>>> Signed-off-by: Vasu Dev <vasu.dev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>>>> Looks good to me. I ran some tests on s390 and the queue depth  
>>>> counter
>>>> increased until hitting the defined maximum.
>>>>
>>>
>>> Good.
>>>
>>>>> @@ -779,6 +781,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;
>>>>> +}
>>>> [...]
>>>>> +	unsigned long queue_ramp_up_period;	/* ramp up period in  
>>>>> jiffies */
>>>>> +#define SCSI_DEFAULT_RAMP_UP_PERIOD	(120 * HZ)
>>>> Only a small inconvenience i guess: The sysfs attribute shows the
>>>> ramp-up-period in jiffies. On my system with HZ==100 the default is
>>>> 12000 and i was wondering if this would be milliseconds or  
>>>> something
>>>> related. If HZ changes, the unit of the ramp-up-period also  
>>>> changes.
>>>>
>>>> I would prefer having seconds or milliseconds in sysfs and only  
>>>> using
>>>> jiffies internally.
>>>>
>>>
>>> Added timestamp comparison checks are straightforward without any
>>> additional conversion on each check since added timestamps and
>>> queue_ramp_up_period both are jiffies, so works better this way with
>>> stored queue_ramp_up_period in jiffies.
>>>
>>> I do see your point as well but jiffies unit is also common in  
>>> Linux.
>>> However if you or some other feels strongly to change this to ms or
>>> seconds unit then I could change store or show sysfs functions to  
>>> handle
>>> this value in ms or second unit while storing it in jiffies in
>>> queue_ramp_up_period.
>>>
>>> 	Vasu
>>
>> I agree with Christof on this, HZ may be 100 on some machines and  
>> 1000
>> on others.  Management tools (if they ever adjust this) would like
>> standard units, so it should be in ms or seconds, and I prefer ms.
>> I would just change the sysfs functions as you say, and use jiffies  
>> internally.
>
> I would also vote for ms in sysfs and using jiffies internally. This
> should be fairly easy using the functions jiffies_to_msecs and
> msecs_to_jiffies.
>
> Christof

I would vote for ms in sysfs since this will be more understandable  
for user.

-- Giri



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

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

* [PATCH v4 5/7] scsi-ml: adds queue_depth ramp up code
  2009-10-16  0:47   ` [PATCH v2 5/7] scsi-ml: adds queue_depth ramp up code Vasu Dev
       [not found]     ` <20091016004700.22451.42962.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
  2009-10-16 23:08     ` [PATCH v3] " Vasu Dev
@ 2009-10-22 22:46     ` Vasu Dev
  2009-10-23 13:53       ` Christof Schmitt
  2 siblings, 1 reply; 23+ messages in thread
From: Vasu Dev @ 2009-10-22 22:46 UTC (permalink / raw)
  To: linux-scsi, devel, James.Bottomley, michaelc, christof.schmitt

Current FC HBA queue_depth ramp up code depends on last queue
full time. 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 full value and then updates its only
current usages in scsi_track_queue_full to ignore last four bits
to keep current usages same while also use this field
in added ramp up code.

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.

The ramp up is skipped in case the change_queue_depth is not
supported by LLD or already reached to added max_queue_depth.

Updates added max_queue_depth on every new update to default
queue_depth value.

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

Adds queue_ramp_up_period to sysfs but only if change_queue_depth
is supported since ramp up and queue_ramp_up_period is needed only
in case change_queue_depth is supported first.

Initializes queue_ramp_up_period to 120HZ jiffies as initial
default value, it is same as used in existing lpfc and qla2xxx.

-v2
 Combined all ramp code into this single patch.

-v3
 Moves max_queue_depth initialization after slave_configure is
called from after slave_alloc calling done. Also adjusted
max_queue_depth check to skip ramp up if current queue_depth
is >= max_queue_depth.

-v4
 Changes sdev->queue_ramp_up_period unit to ms when using sysfs i/f
to store or show its value.

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

 drivers/scsi/scsi.c        |   10 ++++++++--
 drivers/scsi/scsi_error.c  |   38 ++++++++++++++++++++++++++++++++++++++
 drivers/scsi/scsi_scan.c   |    3 +++
 drivers/scsi/scsi_sysfs.c  |   41 +++++++++++++++++++++++++++++++++++++++--
 include/scsi/scsi_device.h |    9 ++++++---
 5 files changed, 94 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index dd098ca..a60da55 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -940,10 +940,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/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 7b1e20f..08ed506 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 ||
+	    sdev->queue_depth >= sdev->max_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 ||
+		    tmp_sdev->queue_depth == sdev->max_queue_depth)
+			continue;
+		/*
+		 * call back into LLD to increase queue_depth by one
+		 * with ramp up reason code.
+		 */
+		sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth + 1,
+					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;
@@ -393,6 +429,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:
@@ -1425,6 +1462,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:
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index cb6338f..2847a86 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;
@@ -940,6 +941,8 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
 		}
 	}
 
+	sdev->max_queue_depth = sdev->queue_depth;
+
 	/*
 	 * Ok, the device is now all set up, we can
 	 * register it and tell the rest of the kernel
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 4c59336..3a9e805 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -771,6 +771,8 @@ sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr,
 	if (retval < 0)
 		return retval;
 
+	sdev->max_queue_depth = sdev->queue_depth;
+
 	return count;
 }
 
@@ -779,6 +781,37 @@ 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, "%u\n",
+			jiffies_to_msecs(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 = msecs_to_jiffies(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 +903,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 9af48cb..92c4c3b 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -81,11 +81,14 @@ struct scsi_device {
 	struct list_head starved_entry;
 	struct scsi_cmnd *current_cmnd;	/* currently active command */
 	unsigned short queue_depth;	/* How deep of a queue we want */
+	unsigned short max_queue_depth;	/* max queue depth */
 	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 */
+#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] 23+ messages in thread

* Re: [PATCH v4 5/7] scsi-ml: adds queue_depth ramp up code
  2009-10-22 22:46     ` [PATCH v4 5/7] " Vasu Dev
@ 2009-10-23 13:53       ` Christof Schmitt
  2009-10-23 17:51         ` Giridhar Malavali
  0 siblings, 1 reply; 23+ messages in thread
From: Christof Schmitt @ 2009-10-23 13:53 UTC (permalink / raw)
  To: Vasu Dev; +Cc: linux-scsi, devel, James.Bottomley, michaelc

On Thu, Oct 22, 2009 at 03:46:33PM -0700, Vasu Dev wrote:
> Current FC HBA queue_depth ramp up code depends on last queue
> full time. 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 full value and then updates its only
> current usages in scsi_track_queue_full to ignore last four bits
> to keep current usages same while also use this field
> in added ramp up code.
> 
> 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.
> 
> The ramp up is skipped in case the change_queue_depth is not
> supported by LLD or already reached to added max_queue_depth.
> 
> Updates added max_queue_depth on every new update to default
> queue_depth value.
> 
> The ramp up is also skipped if lapsed time since either last
> queue ramp up or down is less than LLD specified
> queue_ramp_up_period.
> 
> Adds queue_ramp_up_period to sysfs but only if change_queue_depth
> is supported since ramp up and queue_ramp_up_period is needed only
> in case change_queue_depth is supported first.
> 
> Initializes queue_ramp_up_period to 120HZ jiffies as initial
> default value, it is same as used in existing lpfc and qla2xxx.
> 
> -v2
>  Combined all ramp code into this single patch.
> 
> -v3
>  Moves max_queue_depth initialization after slave_configure is
> called from after slave_alloc calling done. Also adjusted
> max_queue_depth check to skip ramp up if current queue_depth
> is >= max_queue_depth.
> 
> -v4
>  Changes sdev->queue_ramp_up_period unit to ms when using sysfs i/f
> to store or show its value.
> 
> Signed-off-by: Vasu Dev <vasu.dev@intel.com>

The patch looks good. I also ran a brief test on s390 again.

Acked-and-tested-by: Christof Schmitt <christof.schmitt@de.ibm.com>

> ---
> 
>  drivers/scsi/scsi.c        |   10 ++++++++--
>  drivers/scsi/scsi_error.c  |   38 ++++++++++++++++++++++++++++++++++++++
>  drivers/scsi/scsi_scan.c   |    3 +++
>  drivers/scsi/scsi_sysfs.c  |   41 +++++++++++++++++++++++++++++++++++++++--
>  include/scsi/scsi_device.h |    9 ++++++---
>  5 files changed, 94 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
> index dd098ca..a60da55 100644
> --- a/drivers/scsi/scsi.c
> +++ b/drivers/scsi/scsi.c
> @@ -940,10 +940,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/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 7b1e20f..08ed506 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 ||
> +	    sdev->queue_depth >= sdev->max_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 ||
> +		    tmp_sdev->queue_depth == sdev->max_queue_depth)
> +			continue;
> +		/*
> +		 * call back into LLD to increase queue_depth by one
> +		 * with ramp up reason code.
> +		 */
> +		sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth + 1,
> +					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;
> @@ -393,6 +429,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:
> @@ -1425,6 +1462,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:
> diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> index cb6338f..2847a86 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;
> @@ -940,6 +941,8 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
>  		}
>  	}
> 
> +	sdev->max_queue_depth = sdev->queue_depth;
> +
>  	/*
>  	 * Ok, the device is now all set up, we can
>  	 * register it and tell the rest of the kernel
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index 4c59336..3a9e805 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -771,6 +771,8 @@ sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr,
>  	if (retval < 0)
>  		return retval;
> 
> +	sdev->max_queue_depth = sdev->queue_depth;
> +
>  	return count;
>  }
> 
> @@ -779,6 +781,37 @@ 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, "%u\n",
> +			jiffies_to_msecs(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 = msecs_to_jiffies(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 +903,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 9af48cb..92c4c3b 100644
> --- a/include/scsi/scsi_device.h
> +++ b/include/scsi/scsi_device.h
> @@ -81,11 +81,14 @@ struct scsi_device {
>  	struct list_head starved_entry;
>  	struct scsi_cmnd *current_cmnd;	/* currently active command */
>  	unsigned short queue_depth;	/* How deep of a queue we want */
> +	unsigned short max_queue_depth;	/* max queue depth */
>  	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 */
> +#define SCSI_DEFAULT_RAMP_UP_PERIOD	(120 * HZ)
> +
> +	unsigned long last_queue_ramp_up;	/* last queue ramp up time */
> 
>  	unsigned int id, lun, channel;
> 
> 
> --
> 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] 23+ messages in thread

* Re: [PATCH v4 5/7] scsi-ml: adds queue_depth ramp up code
  2009-10-23 13:53       ` Christof Schmitt
@ 2009-10-23 17:51         ` Giridhar Malavali
  0 siblings, 0 replies; 23+ messages in thread
From: Giridhar Malavali @ 2009-10-23 17:51 UTC (permalink / raw)
  To: Christof Schmitt; +Cc: Vasu Dev, linux-scsi, devel, James.Bottomley, michaelc


On Oct 23, 2009, at 6:53 AM, Christof Schmitt wrote:

> On Thu, Oct 22, 2009 at 03:46:33PM -0700, Vasu Dev wrote:
>> Current FC HBA queue_depth ramp up code depends on last queue
>> full time. 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 full value and then updates its only
>> current usages in scsi_track_queue_full to ignore last four bits
>> to keep current usages same while also use this field
>> in added ramp up code.
>>
>> 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.
>>
>> The ramp up is skipped in case the change_queue_depth is not
>> supported by LLD or already reached to added max_queue_depth.
>>
>> Updates added max_queue_depth on every new update to default
>> queue_depth value.
>>
>> The ramp up is also skipped if lapsed time since either last
>> queue ramp up or down is less than LLD specified
>> queue_ramp_up_period.
>>
>> Adds queue_ramp_up_period to sysfs but only if change_queue_depth
>> is supported since ramp up and queue_ramp_up_period is needed only
>> in case change_queue_depth is supported first.
>>
>> Initializes queue_ramp_up_period to 120HZ jiffies as initial
>> default value, it is same as used in existing lpfc and qla2xxx.
>>
>> -v2
>> Combined all ramp code into this single patch.
>>
>> -v3
>> Moves max_queue_depth initialization after slave_configure is
>> called from after slave_alloc calling done. Also adjusted
>> max_queue_depth check to skip ramp up if current queue_depth
>> is >= max_queue_depth.
>>
>> -v4
>> Changes sdev->queue_ramp_up_period unit to ms when using sysfs i/f
>> to store or show its value.
>>
>> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
>
> The patch looks good. I also ran a brief test on s390 again.
>
> Acked-and-tested-by: Christof Schmitt <christof.schmitt@de.ibm.com>

I tested this patch with qla2xxx drivers and looks good.

Acked-and-tested-by: Giridhar Malavali <giridhar.malavali@qlogic.com>

>
>
>> ---
>>
>> drivers/scsi/scsi.c        |   10 ++++++++--
>> drivers/scsi/scsi_error.c  |   38 ++++++++++++++++++++++++++++++++++ 
>> ++++
>> drivers/scsi/scsi_scan.c   |    3 +++
>> drivers/scsi/scsi_sysfs.c  |   41 ++++++++++++++++++++++++++++++++++ 
>> +++++--
>> include/scsi/scsi_device.h |    9 ++++++---
>> 5 files changed, 94 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
>> index dd098ca..a60da55 100644
>> --- a/drivers/scsi/scsi.c
>> +++ b/drivers/scsi/scsi.c
>> @@ -940,10 +940,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/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
>> index 7b1e20f..08ed506 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 ||
>> +	    sdev->queue_depth >= sdev->max_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 ||
>> +		    tmp_sdev->queue_depth == sdev->max_queue_depth)
>> +			continue;
>> +		/*
>> +		 * call back into LLD to increase queue_depth by one
>> +		 * with ramp up reason code.
>> +		 */
>> +		sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth + 1,
>> +					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;
>> @@ -393,6 +429,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:
>> @@ -1425,6 +1462,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:
>> diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
>> index cb6338f..2847a86 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;
>> @@ -940,6 +941,8 @@ static int scsi_add_lun(struct scsi_device  
>> *sdev, unsigned char *inq_result,
>> 		}
>> 	}
>>
>> +	sdev->max_queue_depth = sdev->queue_depth;
>> +
>> 	/*
>> 	 * Ok, the device is now all set up, we can
>> 	 * register it and tell the rest of the kernel
>> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
>> index 4c59336..3a9e805 100644
>> --- a/drivers/scsi/scsi_sysfs.c
>> +++ b/drivers/scsi/scsi_sysfs.c
>> @@ -771,6 +771,8 @@ sdev_store_queue_depth_rw(struct device *dev,  
>> struct device_attribute *attr,
>> 	if (retval < 0)
>> 		return retval;
>>
>> +	sdev->max_queue_depth = sdev->queue_depth;
>> +
>> 	return count;
>> }
>>
>> @@ -779,6 +781,37 @@ 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, "%u\n",
>> +			jiffies_to_msecs(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 = msecs_to_jiffies(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 +903,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 9af48cb..92c4c3b 100644
>> --- a/include/scsi/scsi_device.h
>> +++ b/include/scsi/scsi_device.h
>> @@ -81,11 +81,14 @@ struct scsi_device {
>> 	struct list_head starved_entry;
>> 	struct scsi_cmnd *current_cmnd;	/* currently active command */
>> 	unsigned short queue_depth;	/* How deep of a queue we want */
>> +	unsigned short max_queue_depth;	/* max queue depth */
>> 	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 */
>> +#define SCSI_DEFAULT_RAMP_UP_PERIOD	(120 * HZ)
>> +
>> +	unsigned long last_queue_ramp_up;	/* last queue ramp up time */
>>
>> 	unsigned int id, lun, channel;
>>
>>
>> --
>> 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
> --
> 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] 23+ messages in thread

* Re: [PATCH v2 1/7] scsi-ml: modify change_queue_depth to take in reason why it is being called
       [not found] ` <20091016004639.22451.76363.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
                     ` (5 preceding siblings ...)
  2009-10-16  0:47   ` [PATCH v2 7/7] zfcp: Adapt change_queue_depth for queue full tracking Vasu Dev
@ 2009-10-28 22:48   ` James Bottomley
       [not found]     ` <1256770118.2989.24.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  6 siblings, 1 reply; 23+ messages in thread
From: James Bottomley @ 2009-10-28 22:48 UTC (permalink / raw)
  To: Vasu Dev
  Cc: christof.schmitt-tA70FqPdS9bQT0dZR+AlfA,
	devel-s9riP+hp16TNLxjTenLetw, linux-scsi-u79uwXL29TY76Z2rM5mHXA

On Thu, 2009-10-15 at 17:46 -0700, Vasu Dev wrote:
> From: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
> 
> 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.
> 
> This is a simple port of the drivers setting a change_queue_depth
> callback. In the patch I just have these LLDs adjust the queue depth
> if the user was requesting it.
> 
> Signed-off-by: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
> 
> -v2
> 	Also converted pmcraid_change_queue_depth and then verified
> all modules compile  using "make allmodconfig" for any new build
> warnings on X86_64.
> 
> 	Updated original description after combing two original
> patches from Mike to make this patch git bisectable.
> 
> Signed-off-by: Vasu Dev <vasu.dev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

This still doesn't build:

drivers/scsi/53c700.c: In function 'NCR_700_detect':
drivers/scsi/53c700.c:331: warning: assignment from incompatible pointer type
drivers/scsi/53c700.c: At top level:
drivers/scsi/53c700.c:2085: error: conflicting types for 'NCR_700_change_queue_depth'
drivers/scsi/53c700.c:178: error: previous declaration of 'NCR_700_change_queue_depth' was here

It looks like just an unconverted function prototype, so the patch below fixes it.

James

---

diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index a5a493d..6c60a80 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -175,7 +175,7 @@ STATIC void NCR_700_chip_reset(struct Scsi_Host *host);
 STATIC int NCR_700_slave_alloc(struct scsi_device *SDpnt);
 STATIC int NCR_700_slave_configure(struct scsi_device *SDpnt);
 STATIC void NCR_700_slave_destroy(struct scsi_device *SDpnt);
-static int NCR_700_change_queue_depth(struct scsi_device *SDpnt, int depth);
+static int NCR_700_change_queue_depth(struct scsi_device *SDpnt, int depth, int reason);
 static int NCR_700_change_queue_type(struct scsi_device *SDpnt, int depth);
 
 STATIC struct device_attribute *NCR_700_dev_attrs[];

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

* Re: [PATCH v2 1/7] scsi-ml: modify change_queue_depth to take in reason why it is being called
       [not found]     ` <1256770118.2989.24.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2009-10-29  1:43       ` Vasu Dev
  0 siblings, 0 replies; 23+ messages in thread
From: Vasu Dev @ 2009-10-29  1:43 UTC (permalink / raw)
  To: James Bottomley
  Cc: christof.schmitt-tA70FqPdS9bQT0dZR+AlfA,
	devel-s9riP+hp16TNLxjTenLetw, linux-scsi-u79uwXL29TY76Z2rM5mHXA

On Wed, 2009-10-28 at 22:48 +0000, James Bottomley wrote:
> On Thu, 2009-10-15 at 17:46 -0700, Vasu Dev wrote:
> This still doesn't build:
> 
> drivers/scsi/53c700.c: In function 'NCR_700_detect':
> drivers/scsi/53c700.c:331: warning: assignment from incompatible pointer type
> drivers/scsi/53c700.c: At top level:
> drivers/scsi/53c700.c:2085: error: conflicting types for 'NCR_700_change_queue_depth'
> drivers/scsi/53c700.c:178: error: previous declaration of 'NCR_700_change_queue_depth' was here
> 

Too bad, I tried "make allmodconfig" again after "make distclean" on
x86_64 but again it didn't catch this error since it didn't compile
53c700.c once again, so any trick to really force all modules
compilation to catch such errors in future ?

> It looks like just an unconverted function prototype, so the patch below fixes it.
> 

Thanks James for the fix and I suppose I don't need to send updated
patch again with your fix since probably you will roll this fix into
this patch when applying this patch.

	Vasu

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

end of thread, other threads:[~2009-10-29  1:43 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-16  0:46 [PATCH v2 1/7] scsi-ml: modify change_queue_depth to take in reason why it is being called Vasu Dev
     [not found] ` <20091016004639.22451.76363.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
2009-10-16  0:46   ` [PATCH v2 2/7] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL Vasu Dev
2009-10-16  0:46   ` [PATCH v2 3/7] libfc: convert libfc calling scsi_track_queue_full Vasu Dev
2009-10-16  0:46   ` [PATCH v2 4/7] fcoe, libfc: fix an libfc issue with queue ramp down in libfc Vasu Dev
2009-10-16  0:47   ` [PATCH v2 5/7] scsi-ml: adds queue_depth ramp up code Vasu Dev
     [not found]     ` <20091016004700.22451.42962.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
2009-10-16  9:29       ` Christof Schmitt
     [not found]         ` <20091016092912.GA7199-VuU8Q2ydlaqCpDFQwvYvMTJtLkR7yuzc@public.gmane.org>
2009-10-16 18:16           ` Vasu Dev
2009-10-16 23:08     ` [PATCH v3] " Vasu Dev
     [not found]       ` <20091016230824.18916.84116.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/G2K4zDHf@public.gmane.org>
2009-10-20 18:54         ` Christof Schmitt
2009-10-20 22:32           ` Vasu Dev
2009-10-20 23:14             ` [Open-FCoE] " Joe Eykholt
     [not found]               ` <4ADE444D.5090307-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2009-10-21  7:49                 ` Christof Schmitt
2009-10-21 17:45                   ` [Open-FCoE] " Vasu Dev
     [not found]                   ` <20091021074944.GA3563-VuU8Q2ydlaqCpDFQwvYvMTJtLkR7yuzc@public.gmane.org>
2009-10-21 17:54                     ` Giridhar Malavali
2009-10-21 13:11               ` [Open-FCoE] " James Smart
2009-10-21 13:37             ` Michael Reed
2009-10-22 22:46     ` [PATCH v4 5/7] " Vasu Dev
2009-10-23 13:53       ` Christof Schmitt
2009-10-23 17:51         ` Giridhar Malavali
2009-10-16  0:47   ` [PATCH v2 6/7] libfc: adds queue_depth ramp up to libfc Vasu Dev
2009-10-16  0:47   ` [PATCH v2 7/7] zfcp: Adapt change_queue_depth for queue full tracking Vasu Dev
2009-10-28 22:48   ` [PATCH v2 1/7] scsi-ml: modify change_queue_depth to take in reason why it is being called James Bottomley
     [not found]     ` <1256770118.2989.24.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-10-29  1:43       ` Vasu Dev

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.