scsi-ml: modify change_queue_depth to take in reason why it is being called
PATCH v2 1/7 scsi-ml: modify change_queue_depth to take in reason why it is being called
From: Mike Christie <[email protected]>
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.
-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.
---
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(-)
drivers/ata/libata-scsi.c +6 -1
@@ -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;
drivers/ata/sata_nv.c +1 -1
@@ -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); }
drivers/message/fusion/mptscsih.c +7 -2
@@ -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,
drivers/message/fusion/mptscsih.h +2 -1
@@ -128,7 +128,8 @@ extern int mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_Fextern 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[];
drivers/s390/scsi/zfcp_scsi.c +5 -1
@@ -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; }
drivers/scsi/3w-9xxx.c +5 -1
@@ -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);
drivers/scsi/3w-xxxx.c +5 -1
@@ -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);
drivers/scsi/53c700.c +4 -1
@@ -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 ;
drivers/scsi/aacraid/linit.c +5 -1
@@ -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;
drivers/scsi/arcmsr/arcmsr_hba.c +4 -1
@@ -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);
drivers/scsi/hptiop.c +4 -1
@@ -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);
drivers/scsi/ibmvscsi/ibmvfc.c +6 -1
@@ -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 ;
drivers/scsi/ibmvscsi/ibmvscsi.c +6 -1
@@ -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 ;
drivers/scsi/ipr.c +6 -1
@@ -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;
drivers/scsi/libfc/fc_fcp.c +4 -1
@@ -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; }
drivers/scsi/libiscsi.c +4 -1
@@ -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; }
drivers/scsi/libsas/sas_scsi_host.c +5 -1
@@ -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);
drivers/scsi/megaraid/megaraid_mbox.c +6 -1
@@ -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);
drivers/scsi/mpt2sas/mpt2sas_scsih.c +7 -3
@@ -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);
drivers/scsi/pmcraid.c +6 -1
@@ -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 ;
drivers/scsi/qla2xxx/qla_os.c +5 -2
@@ -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; }
drivers/scsi/scsi_sysfs.c +2 -1
@@ -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;
include/linux/libata.h +1 -1
@@ -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);
include/scsi/libfc.h +1 -1
@@ -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.
include/scsi/libiscsi.h +2 -1
@@ -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);
include/scsi/libsas.h +2 -1
@@ -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 *,
include/scsi/scsi_host.h +7 -1
@@ -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
A message that is not in the archive (sent off-list or not yet received): 20091016004639.22451.76363.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/[email protected]
PATCH v2 2/7 scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL
From: Mike Christie <[email protected]>
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.
-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.
---
drivers/scsi/scsi_error.c | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-)
drivers/scsi/scsi_error.c +26 -1
@@ -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.
PATCH v2 3/7 libfc: convert libfc calling scsi_track_queue_full
In reply to a message not in the archiveFrom: Mike Christie <[email protected]>
This converts the libfc using scsi_track_queue_full to track the queue full from the change_queue_depth callback.
---
drivers/scsi/libfc/fc_fcp.c | 27 +++++++++------------------ 1 files changed, 9 insertions(+), 18 deletions(-)
drivers/scsi/libfc/fc_fcp.c +9 -18
@@ -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);
PATCH v2 4/7 fcoe, libfc: fix an libfc issue with queue ramp down in libfc
In reply to a message not in the archiveThe 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.
---
drivers/scsi/fcoe/fcoe.c | 2 +- drivers/scsi/libfc/fc_fcp.c | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-)
drivers/scsi/fcoe/fcoe.c +1 -1
@@ -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,
drivers/scsi/libfc/fc_fcp.c +6 -8
@@ -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);
PATCH v2 5/7 scsi-ml: adds queue_depth ramp up code
In reply to a message not in the archiveCurrent 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.
---
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(-)
drivers/scsi/scsi.c +8 -2
@@ -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;
drivers/scsi/scsi_error.c +38 -0
@@ -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 :
drivers/scsi/scsi_scan.c +3 -0
@@ -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:
drivers/scsi/scsi_sysfs.c +38 -2
@@ -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) {
include/scsi/scsi_device.h +6 -3
@@ -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;
A message that is not in the archive (sent off-list or not yet received): 20091016004700.22451.42962.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/[email protected]
Re: [PATCH v2 5/7] scsi-ml: adds queue_depth ramp up code
Quoted 16 lines · Vasu Dev
drivers/scsi/scsi_error.c +8
-0@@ -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 ;
[...]
Quoted 11 lines
drivers/scsi/scsi_scan.c +1
-0@@ -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;
drivers/scsi/scsi_scan.c static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, · line 318
Quoted 6 lines
drivers/scsi/scsi_scan.c +2
-0@@ -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
A message that is not in the archive (sent off-list or not yet received): 20091016092912.GA7199-VuU8Q2ydlaqCpDFQwvYvMTJtLkR7yuzc@public.gmane.org
Re: [PATCH v2 5/7] scsi-ml: adds queue_depth ramp up code
Quoted 32 lines · Christof Schmitt
Quoted 16 lines · Vasu Dev
drivers/scsi/scsi_error.c +8
-0@@ -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 ;[...]
Quoted 14 lines
drivers/scsi/scsi_scan.c +1
-0@@ -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, } }
Quoted 9 lines
drivers/scsi/scsi_scan.c static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, · line 318
Quoted 3 lines
drivers/scsi/scsi_scan.c +2
-0+ sdev->max_queue_depth = sdev->queue_depth; +return sdev;Running this patches series with the zfcp device driver increases the
queue_depthbeyond the maximum. The problem is that afterslave_alloc, thequeue_depthis 1 fromcmd_per_lunand this is the value used formax_queue_depth.
I see, I missed this case to update max_queue_depth since libfc is not using slave_configure.
Quoted 6 lines
zfcp then adjust the
queue_depthand tagging inslave_configure. Now, thequeue_depthis 32 and themax_queue_depthis still 1. And the check forsdev->queue_depth==sdev->max_queue_depthis never true.What is the best way to solve this? Move the initial assignment of
max_queue_depthto be called after the call toslave_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 ?
Quoted 2 lines
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
Quoted 6 lines
--
Christof
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 1/1 scsi-ml: adds queue_depth ramp up code
In reply to Vasu DevCurrent 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.
---
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(-)
drivers/scsi/scsi.c +8 -2
@@ -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;
drivers/scsi/scsi_error.c +38 -0
@@ -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 :
drivers/scsi/scsi_scan.c +3 -0
@@ -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
drivers/scsi/scsi_sysfs.c +38 -2
@@ -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) {
include/scsi/scsi_device.h +6 -3
@@ -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;
A message that is not in the archive (sent off-list or not yet received): 20091016230824.18916.84116.stgit-M4Lc0Xp98oKtqXYlAKuG4QC/[email protected]
Re: [PATCH v3] scsi-ml: adds queue_depth ramp up code
Quoted 7 lines · Vasu Dev
-v3
Movesmax_queue_depthinitialization afterslave_configureis
called from afterslave_alloccalling done. Also adjustedmax_queue_depthcheck to skip ramp up if currentqueue_depthis >=max_queue_depth.Signed-off-by Vasu Dev <[email protected]>
Looks good to me. I ran some tests on s390 and the queue depth counter increased until hitting the defined maximum.
Quoted 27 lines
drivers/scsi/scsi_sysfs.c +23
-0@@ -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; +}
[...]
include/scsi/scsi_device.h struct scsi_device { · line 89
Quoted 2 lines
include/scsi/scsi_device.h +2
-0+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
Re: [PATCH v3] scsi-ml: adds queue_depth ramp up code
Quoted 7 lines · Christof Schmitt
Quoted 6 lines · Vasu Dev
-v3
Movesmax_queue_depthinitialization afterslave_configureis
called from afterslave_alloccalling done. Also adjustedmax_queue_depthcheck to skip ramp up if currentqueue_depthis >=max_queue_depth.
Quoted 5 lines
Quoted 1 line
Signed-off-by Vasu Dev <[email protected]>Looks good to me. I ran some tests on s390 and the queue depth counter increased until hitting the defined maximum.
Good.
Quoted 37 lines
Quoted 27 lines
drivers/scsi/scsi_sysfs.c +23
-0@@ -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; +}[...]
include/scsi/scsi_device.h struct scsi_device { · line 89
Quoted 2 lines
include/scsi/scsi_device.h +2
-0+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.
Quoted 3 lines
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
Quoted 7 lines
Thanks for doing this,
Christof
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Open-FCoE] [PATCH v3] scsi-ml: adds queue_depth ramp up code
Quoted 59 lines · Vasu Dev
Quoted 11 lines · Christof Schmitt
Quoted 7 lines · Vasu Dev
-v3
Movesmax_queue_depthinitialization afterslave_configureis
called from afterslave_alloccalling done. Also adjustedmax_queue_depthcheck to skip ramp up if currentqueue_depthis >=max_queue_depth.Signed-off-by Vasu Dev <[email protected]>Looks good to me. I ran some tests on s390 and the queue depth counter increased until hitting the defined maximum.
Good.
Quoted 35 lines
Quoted 27 lines
drivers/scsi/scsi_sysfs.c +23
-0@@ -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; +}[...]
include/scsi/scsi_device.h struct scsi_device { · line 89
Quoted 2 lines
include/scsi/scsi_device.h +2
-0+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.
Quoted 3 lines
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_periodboth are jiffies, so works better this way with storedqueue_ramp_up_periodin jiffies.
Quoted 7 lines
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
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3] scsi-ml: adds queue_depth ramp up code
Quoted 66 lines · Joe Eykholt
Quoted 65 lines · Vasu Dev
Quoted 11 lines · Christof Schmitt
Quoted 7 lines · Vasu Dev
-v3
Movesmax_queue_depthinitialization afterslave_configureis
called from afterslave_alloccalling done. Also adjustedmax_queue_depthcheck to skip ramp up if currentqueue_depthis >=max_queue_depth.Signed-off-by Vasu Dev <[email protected]>Looks good to me. I ran some tests on s390 and the queue depth counter increased until hitting the defined maximum.
Good.
Quoted 35 lines
Quoted 27 lines
drivers/scsi/scsi_sysfs.c +23
-0@@ -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; +}[...]
include/scsi/scsi_device.h struct scsi_device { · line 89
Quoted 2 lines
include/scsi/scsi_device.h +2
-0+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.
Quoted 3 lines
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_periodboth are jiffies, so works better this way with storedqueue_ramp_up_periodin 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.
Quoted 6 lines
Quoted 1 line
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
Re: [Open-FCoE] [PATCH v3] scsi-ml: adds queue_depth ramp up code
Quoted 18 lines · Christof Schmitt
Quoted 3 lines
Quoted 3 lines
Added timestamp comparison checks are straightforward without any additional conversion on each check since added timestamps and
queue_ramp_up_periodboth are jiffies, so works better this waywith
Quoted 3 lines
Quoted 3 lines
stored
queue_ramp_up_periodin jiffies.I do see your point as well but jiffies unit is also common in
Linux.
Quoted 2 lines
Quoted 2 lines
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
Quoted 6 lines
Quoted 4 lines
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
Quoted 8 lines
Quoted 3 lines
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_msecsandmsecs_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
A message that is not in the archive (sent off-list or not yet received): 20091021074944.GA3563-VuU8Q2ydlaqCpDFQwvYvMTJtLkR7yuzc@public.gmane.org
Re: [PATCH v3] scsi-ml: adds queue_depth ramp up code
Quoted 84 lines · Christof Schmitt
Quoted 74 lines · Joe Eykholt
Quoted 73 lines · Vasu Dev
Quoted 7 lines · Christof Schmitt
Quoted 6 lines · Vasu Dev
-v3
Movesmax_queue_depthinitialization afterslave_configureis called from afterslave_alloccalling done. Also adjustedmax_queue_depthcheck to skip ramp up if currentqueue_depthis >=max_queue_depth.Quoted 5 lines
Quoted 1 line
Signed-off-by Vasu Dev <[email protected]>Looks good to me. I ran some tests on s390 and the queue depth counter
increased until hitting the defined maximum.Good.
Quoted 39 lines
Quoted 28 lines
(quoted diff) +0
-0@@ -779,6 +781,36 @@ static struct device_attribute
sdev_attr_queue_depth_rw=sdev_store_queue_depth_rw);static
ssize_t(quoted diff) +23
-0+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; +}[...]
Quoted 3 lines
(quoted diff) +1
-0+ unsigned long queue_ramp_up_period; /* ramp up period injiffies */
+#defineSCSI_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.Quoted 4 lines
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_periodboth are jiffies, so works better this way with storedqueue_ramp_up_periodin 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 inqueue_ramp_up_period.Quoted 8 lines
Quoted 1 line
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.
Quoted 5 lines
I would also vote for ms in sysfs and using jiffies internally. This should be fairly easy using the functions
jiffies_to_msecsandmsecs_to_jiffies.Christof
I would vote for ms in sysfs since this will be more understandable for user.
-- Giri
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux- scsi" in
the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Open-FCoE] [PATCH v3] scsi-ml: adds queue_depth ramp up code
In reply to Joe EykholtQuoted 16 lines · Joe Eykholt
Quoted 15 lines · Vasu Dev
Quoted 3 lines · Christof Schmitt
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_periodboth are jiffies, so works better this way with storedqueue_ramp_up_periodin 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.
Quoted 8 lines
Quoted 1 line
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
Re: [PATCH v3] scsi-ml: adds queue_depth ramp up code
In reply to Vasu DevQuoted 59 lines · Vasu Dev
Quoted 11 lines · Christof Schmitt
Quoted 7 lines · Vasu Dev
-v3
Movesmax_queue_depthinitialization afterslave_configureis
called from afterslave_alloccalling done. Also adjustedmax_queue_depthcheck to skip ramp up if currentqueue_depthis >=max_queue_depth.Signed-off-by Vasu Dev <[email protected]>Looks good to me. I ran some tests on s390 and the queue depth counter increased until hitting the defined maximum.
Good.
Quoted 35 lines
Quoted 27 lines
drivers/scsi/scsi_sysfs.c +23
-0@@ -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; +}[...]
include/scsi/scsi_device.h struct scsi_device { · line 89
Quoted 2 lines
include/scsi/scsi_device.h +2
-0+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.
Quoted 3 lines
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_periodboth are jiffies, so works better this way with storedqueue_ramp_up_periodin jiffies.
Quoted 5 lines
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
Quoted 15 lines
Vasu
Quoted 7 lines
Thanks for doing this,
Christof
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 5/7 scsi-ml: adds queue_depth ramp up code
In reply to Vasu DevCurrent 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.
---
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(-)
drivers/scsi/scsi.c +8 -2
@@ -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;
drivers/scsi/scsi_error.c +38 -0
@@ -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 :
drivers/scsi/scsi_scan.c +3 -0
@@ -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
drivers/scsi/scsi_sysfs.c +39 -2
59 lines not on this page · raw message
include/scsi/scsi_device.h +6 -3
@@ -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;
Re: [PATCH v4 5/7] scsi-ml: adds queue_depth ramp up code
Quoted 42 lines · Vasu Dev
Current FC HBA
queue_depthramp up code depends on last queue full time. The sdev already haslast_queue_full_timefield to track last queue full time but stored value is truncated by last four bits.So this patch updates
last_queue_full_timewithout truncating last 4 bits to store full value and then updates its only current usages inscsi_track_queue_fullto ignore last four bits to keep current usages same while also use this field in added ramp up code.Adds
scsi_handle_queue_ramp_upto ramp upqueue_depthon successful completion of IO. Thescsi_handle_queue_ramp_upwill 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_depthis not supported by LLD or already reached to addedmax_queue_depth.Updates added
max_queue_depthon every new update to defaultqueue_depthvalue.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_periodto sysfs but only ifchange_queue_depthis supported since ramp up andqueue_ramp_up_periodis needed only in casechange_queue_depthis supported first.Initializes
queue_ramp_up_periodto 120HZ jiffies as initial default value, it is same as used in existing lpfc and qla2xxx.(quoted diff) +0
-2-v2 Combined all ramp code into this single patch. -v3 Moves max_queue_depth initialization after slave_configure iscalled from after
slave_alloccalling done. Also adjustedmax_queue_depthcheck to skip ramp up if currentqueue_depthis >=max_queue_depth.
Quoted 5 lines
-v4
Changessdev->queue_ramp_up_periodunit to ms when using sysfs i/f
to store or show its value.Signed-off-by Vasu Dev <[email protected]>
The patch looks good. I also ran a brief test on s390 again.
Quoted 209 lines
---
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(-)drivers/scsi/scsi.c +8
-2@@ -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;drivers/scsi/scsi_error.c +38
-0@@ -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 :drivers/scsi/scsi_scan.c +3
-0@@ -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 drivers/scsi/scsi_sysfs.c +39
-2@@ -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) {include/scsi/scsi_device.h +6
-4@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 5/7] scsi-ml: adds queue_depth ramp up code
Quoted 47 lines · Christof Schmitt
Quoted 46 lines · Vasu Dev
Current FC HBA
queue_depthramp up code depends on last queue full time. The sdev already haslast_queue_full_timefield to track last queue full time but stored value is truncated by last four bits.So this patch updates
last_queue_full_timewithout truncating last 4 bits to store full value and then updates its only current usages inscsi_track_queue_fullto ignore last four bits to keep current usages same while also use this field in added ramp up code.Adds
scsi_handle_queue_ramp_upto ramp upqueue_depthon successful completion of IO. Thescsi_handle_queue_ramp_upwill 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_depthis not supported by LLD or already reached to addedmax_queue_depth.Updates added
max_queue_depthon every new update to defaultqueue_depthvalue.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_periodto sysfs but only ifchange_queue_depthis supported since ramp up andqueue_ramp_up_periodis needed only in casechange_queue_depthis supported first.Initializes
queue_ramp_up_periodto 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
Movesmax_queue_depthinitialization afterslave_configureis called from afterslave_alloccalling done. Also adjustedmax_queue_depthcheck to skip ramp up if currentqueue_depthis >=max_queue_depth.-v4
Changessdev->queue_ramp_up_periodunit to ms when using sysfs i/f to store or show its value.
Quoted 5 lines
Quoted 1 line
Signed-off-by Vasu Dev <[email protected]>The patch looks good. I also ran a brief test on s390 again.
Acked-and-tested-by Christof Schmitt <[email protected]>
I tested this patch with qla2xxx drivers and looks good.
Quoted 229 lines
Quoted 218 lines
---
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(-)drivers/scsi/scsi.c +8
-2@@ -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;drivers/scsi/scsi_error.c +36
-0@@ -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;drivers/scsi/scsi_error.c +1
-0@@ -393,6 +429,7 @@ static int scsi_eh_completed_normally(structscsi_cmnd *scmd) */ switch (status_byte (scmd->result)) {case GOOD : +scsi_handle_queue_ramp_up (scmd->device);case COMMAND_TERMINATED :return SUCCESS ;case
CHECK_CONDITION:drivers/scsi/scsi_error.c +1
-0@@ -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:drivers/scsi/scsi_scan.c +1
-0@@ -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;drivers/scsi/scsi_scan.c +2
-0@@ -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
drivers/scsi/scsi_sysfs.c +2
-0@@ -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_tdrivers/scsi/scsi_sysfs.c +31
-0+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_tsdev_store_queue_type_rw(struct device *dev, struct
device_attribute*attr,
const char *buf,size_tcount)
{drivers/scsi/scsi_sysfs.c +0
-0@@ -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 */
drivers/scsi/scsi_sysfs.c +0
-2-if (sdev->host->hostt->change_queue_depth) - error = device_create_file(&sdev->sdev_gendev,
&sdev_attr_queue_depth_rw);drivers/scsi/scsi_sysfs.c +6
-0+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) {include/scsi/scsi_device.h +1
-1@@ -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
include/scsi/scsi_device.h +5
-2-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 */ Quoted 7 lines
unsigned int id, lun, channel;--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 6/7 libfc: adds queue_depth ramp up to libfc
In reply to a message not in the archiveAdjust queue_depth on fc_change_queue_depth call back with reason SCSI_QDEPTH_RAMP_UP, no additional resource adjustments necessary for libfc.
---
drivers/scsi/libfc/fc_fcp.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/scsi/libfc/fc_fcp.c +3 -0
@@ -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 ; }
PATCH v2 7/7 zfcp: Adapt change_queue_depth for queue full tracking
In reply to a message not in the archiveFrom: Christof Schmitt <[email protected]>
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.
Removes check for (depth <= default_depth) in case of SCSI_QDEPTH_RAMP_UP call back, not needed after added max_queue_depth per sdev.
---
drivers/s390/scsi/zfcp_scsi.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +12 -3
@@ -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; }
Quoted 18 lines · Vasu Dev
From: Mike Christie <[email protected]>
This patch modifies
scsi_host_tematepl->change_queue_depthso 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_depthcallback. In the patch I just have these LLDs adjust the queue depth if the user was requesting it.Signed-off-by Mike Christie <[email protected]>-v2
Also convertedpmcraid_change_queue_depthand then verified
all modules compile using "make allmodconfig" for any new build warnings onX86_64.
Quoted 4 lines
Updated original description after combing two original
patches from Mike to make this patch git bisectable.Signed-off-by Vasu Dev <[email protected]>
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
---
drivers/scsi/53c700.c +1 -1
@@ -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[];
A message that is not in the archive (sent off-list or not yet received): 1256770118.2989.24.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
Quoted 9 lines · James Bottomley
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 typedrivers/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 ?
Quoted 2 lines
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