Commit e881a172 authored by Mike Christie's avatar Mike Christie Committed by James Bottomley
Browse files

[SCSI] modify change_queue_depth to take in reason why it is being called



This patch modifies scsi_host_template->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: default avatarMike Christie <michaelc@cs.wisc.edu>

[Vasu.Dev: 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: default avatarVasu Dev <vasu.dev@intel.com>
[jejb: fixed up 53c700]
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent dbf9bfe6
...@@ -1208,6 +1208,7 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev) ...@@ -1208,6 +1208,7 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
* ata_scsi_change_queue_depth - SCSI callback for queue depth config * ata_scsi_change_queue_depth - SCSI callback for queue depth config
* @sdev: SCSI device to configure queue depth for * @sdev: SCSI device to configure queue depth for
* @queue_depth: new queue depth * @queue_depth: new queue depth
* @reason: calling context
* *
* This is libata standard hostt->change_queue_depth callback. * This is libata standard hostt->change_queue_depth callback.
* SCSI will call into this callback when user tries to set queue * 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) ...@@ -1219,12 +1220,16 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
* RETURNS: * RETURNS:
* Newly configured queue depth. * 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_port *ap = ata_shost_to_port(sdev->host);
struct ata_device *dev; struct ata_device *dev;
unsigned long flags; unsigned long flags;
if (reason != SCSI_QDEPTH_DEFAULT)
return -EOPNOTSUPP;
if (queue_depth < 1 || queue_depth == sdev->queue_depth) if (queue_depth < 1 || queue_depth == sdev->queue_depth)
return sdev->queue_depth; return sdev->queue_depth;
......
...@@ -1975,7 +1975,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev) ...@@ -1975,7 +1975,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)); ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
if (strncmp(model_num, "Maxtor", 6) == 0) { 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, ata_dev_printk(dev, KERN_NOTICE,
"Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth); "Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth);
} }
......
...@@ -2351,11 +2351,12 @@ mptscsih_slave_destroy(struct scsi_device *sdev) ...@@ -2351,11 +2351,12 @@ mptscsih_slave_destroy(struct scsi_device *sdev)
* mptscsih_change_queue_depth - This function will set a devices queue depth * mptscsih_change_queue_depth - This function will set a devices queue depth
* @sdev: per scsi_device pointer * @sdev: per scsi_device pointer
* @qdepth: requested queue depth * @qdepth: requested queue depth
* @reason: calling context
* *
* Adding support for new 'change_queue_depth' api. * Adding support for new 'change_queue_depth' api.
*/ */
int 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); MPT_SCSI_HOST *hd = shost_priv(sdev->host);
VirtTarget *vtarget; VirtTarget *vtarget;
...@@ -2367,6 +2368,9 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth) ...@@ -2367,6 +2368,9 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
starget = scsi_target(sdev); starget = scsi_target(sdev);
vtarget = starget->hostdata; vtarget = starget->hostdata;
if (reason != SCSI_QDEPTH_DEFAULT)
return -EOPNOTSUPP;
if (ioc->bus_type == SPI) { if (ioc->bus_type == SPI) {
if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)) if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES))
max_depth = 1; max_depth = 1;
...@@ -2433,7 +2437,8 @@ mptscsih_slave_configure(struct scsi_device *sdev) ...@@ -2433,7 +2437,8 @@ mptscsih_slave_configure(struct scsi_device *sdev)
ioc->name, vtarget->negoFlags, vtarget->maxOffset, ioc->name, vtarget->negoFlags, vtarget->maxOffset,
vtarget->minSyncFactor)); 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 dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
"tagged %d, simple %d, ordered %d\n", "tagged %d, simple %d, ordered %d\n",
ioc->name,sdev->tagged_supported, sdev->simple_tags, ioc->name,sdev->tagged_supported, sdev->simple_tags,
......
...@@ -128,7 +128,8 @@ extern int mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_F ...@@ -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_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_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); 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 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 int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id);
extern struct device_attribute *mptscsih_host_attrs[]; extern struct device_attribute *mptscsih_host_attrs[];
......
...@@ -29,8 +29,12 @@ char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *fcp_rsp_iu) ...@@ -29,8 +29,12 @@ char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *fcp_rsp_iu)
return fcp_sns_info_ptr; 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); scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
return sdev->queue_depth; return sdev->queue_depth;
} }
......
...@@ -186,8 +186,12 @@ static ssize_t twa_show_stats(struct device *dev, ...@@ -186,8 +186,12 @@ static ssize_t twa_show_stats(struct device *dev,
} /* End twa_show_stats() */ } /* End twa_show_stats() */
/* This function will set a devices queue depth */ /* 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) if (queue_depth > TW_Q_LENGTH-2)
queue_depth = TW_Q_LENGTH-2; queue_depth = TW_Q_LENGTH-2;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
......
...@@ -521,8 +521,12 @@ static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr, ...@@ -521,8 +521,12 @@ static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr,
} /* End tw_show_stats() */ } /* End tw_show_stats() */
/* This function will set a devices queue depth */ /* 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) if (queue_depth > TW_Q_LENGTH-2)
queue_depth = TW_Q_LENGTH-2; queue_depth = TW_Q_LENGTH-2;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
......
...@@ -175,7 +175,7 @@ STATIC void NCR_700_chip_reset(struct Scsi_Host *host); ...@@ -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_alloc(struct scsi_device *SDpnt);
STATIC int NCR_700_slave_configure(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 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 int NCR_700_change_queue_type(struct scsi_device *SDpnt, int depth);
STATIC struct device_attribute *NCR_700_dev_attrs[]; STATIC struct device_attribute *NCR_700_dev_attrs[];
...@@ -2082,8 +2082,11 @@ NCR_700_slave_destroy(struct scsi_device *SDp) ...@@ -2082,8 +2082,11 @@ NCR_700_slave_destroy(struct scsi_device *SDp)
} }
static int 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) if (depth > NCR_700_MAX_TAGS)
depth = NCR_700_MAX_TAGS; depth = NCR_700_MAX_TAGS;
......
...@@ -472,8 +472,12 @@ static int aac_slave_configure(struct scsi_device *sdev) ...@@ -472,8 +472,12 @@ static int aac_slave_configure(struct scsi_device *sdev)
* total capacity and the queue depth supported by the target device. * 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) && if (sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
(sdev_channel(sdev) == CONTAINER_CHANNEL)) { (sdev_channel(sdev) == CONTAINER_CHANNEL)) {
struct scsi_device * dev; struct scsi_device * dev;
......
...@@ -98,8 +98,11 @@ static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb); ...@@ -98,8 +98,11 @@ static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb);
static const char *arcmsr_info(struct Scsi_Host *); static const char *arcmsr_info(struct Scsi_Host *);
static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb); static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb);
static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev, 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) if (queue_depth > ARCMSR_MAX_CMD_PERLUN)
queue_depth = ARCMSR_MAX_CMD_PERLUN; queue_depth = ARCMSR_MAX_CMD_PERLUN;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
......
...@@ -861,10 +861,13 @@ static int hptiop_reset(struct scsi_cmnd *scp) ...@@ -861,10 +861,13 @@ static int hptiop_reset(struct scsi_cmnd *scp)
} }
static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev, 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; struct hptiop_hba *hba = (struct hptiop_hba *)sdev->host->hostdata;
if (reason != SCSI_QDEPTH_DEFAULT)
return -EOPNOTSUPP;
if (queue_depth > hba->max_requests) if (queue_depth > hba->max_requests)
queue_depth = hba->max_requests; queue_depth = hba->max_requests;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
......
...@@ -2764,12 +2764,17 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev) ...@@ -2764,12 +2764,17 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev)
* ibmvfc_change_queue_depth - Change the device's queue depth * ibmvfc_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct * @sdev: scsi device struct
* @qdepth: depth to set * @qdepth: depth to set
* @reason: calling context
* *
* Return value: * Return value:
* actual depth set * 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) if (qdepth > IBMVFC_MAX_CMDS_PER_LUN)
qdepth = IBMVFC_MAX_CMDS_PER_LUN; qdepth = IBMVFC_MAX_CMDS_PER_LUN;
......
...@@ -1637,12 +1637,17 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev) ...@@ -1637,12 +1637,17 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev)
* ibmvscsi_change_queue_depth - Change the device's queue depth * ibmvscsi_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct * @sdev: scsi device struct
* @qdepth: depth to set * @qdepth: depth to set
* @reason: calling context
* *
* Return value: * Return value:
* actual depth set * 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) if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN)
qdepth = IBMVSCSI_MAX_CMDS_PER_LUN; qdepth = IBMVSCSI_MAX_CMDS_PER_LUN;
......
...@@ -3367,16 +3367,21 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) { return 0; }; ...@@ -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 * ipr_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct * @sdev: scsi device struct
* @qdepth: depth to set * @qdepth: depth to set
* @reason: calling context
* *
* Return value: * Return value:
* actual depth set * 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_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
struct ipr_resource_entry *res; struct ipr_resource_entry *res;
unsigned long lock_flags = 0; unsigned long lock_flags = 0;
if (reason != SCSI_QDEPTH_DEFAULT)
return -EOPNOTSUPP;
spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
res = (struct ipr_resource_entry *)sdev->hostdata; res = (struct ipr_resource_entry *)sdev->hostdata;
......
...@@ -2064,8 +2064,11 @@ int fc_slave_alloc(struct scsi_device *sdev) ...@@ -2064,8 +2064,11 @@ int fc_slave_alloc(struct scsi_device *sdev)
} }
EXPORT_SYMBOL(fc_slave_alloc); 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); scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
return sdev->queue_depth; return sdev->queue_depth;
} }
......
...@@ -1643,8 +1643,11 @@ fault: ...@@ -1643,8 +1643,11 @@ fault:
} }
EXPORT_SYMBOL_GPL(iscsi_queuecommand); 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); scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
return sdev->queue_depth; return sdev->queue_depth;
} }
......
...@@ -820,10 +820,14 @@ void sas_slave_destroy(struct scsi_device *scsi_dev) ...@@ -820,10 +820,14 @@ void sas_slave_destroy(struct scsi_device *scsi_dev)
ata_port_disable(dev->sata_dev.ap); 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); int res = min(new_depth, SAS_MAX_QD);
if (reason != SCSI_QDEPTH_DEFAULT)
return -EOPNOTSUPP;
if (scsi_dev->tagged_supported) if (scsi_dev->tagged_supported)
scsi_adjust_queue_depth(scsi_dev, scsi_get_tag_type(scsi_dev), scsi_adjust_queue_depth(scsi_dev, scsi_get_tag_type(scsi_dev),
res); res);
......
...@@ -335,12 +335,17 @@ static struct device_attribute *megaraid_sdev_attrs[] = { ...@@ -335,12 +335,17 @@ static struct device_attribute *megaraid_sdev_attrs[] = {
* megaraid_change_queue_depth - Change the device's queue depth * megaraid_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct * @sdev: scsi device struct
* @qdepth: depth to set * @qdepth: depth to set
* @reason: calling context
* *
* Return value: * Return value:
* actual depth set * 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) if (qdepth > MBOX_MAX_SCSI_CMDS)
qdepth = MBOX_MAX_SCSI_CMDS; qdepth = MBOX_MAX_SCSI_CMDS;
scsi_adjust_queue_depth(sdev, 0, qdepth); scsi_adjust_queue_depth(sdev, 0, qdepth);
......
...@@ -1099,11 +1099,12 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc, ...@@ -1099,11 +1099,12 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc,
* _scsih_change_queue_depth - setting device queue depth * _scsih_change_queue_depth - setting device queue depth
* @sdev: scsi device struct * @sdev: scsi device struct
* @qdepth: requested queue depth * @qdepth: requested queue depth
* @reason: calling context
* *
* Returns queue depth. * Returns queue depth.
*/ */
static int 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; struct Scsi_Host *shost = sdev->host;
int max_depth; int max_depth;
...@@ -1114,6 +1115,9 @@ _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth) ...@@ -1114,6 +1115,9 @@ _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
struct _sas_device *sas_device; struct _sas_device *sas_device;
unsigned long flags; unsigned long flags;
if (reason != SCSI_QDEPTH_DEFAULT)
return -EOPNOTSUPP;
max_depth = shost->can_queue; max_depth = shost->can_queue;
/* limit max device queue for SATA to 32 */ /* limit max device queue for SATA to 32 */
...@@ -1569,7 +1573,7 @@ _scsih_slave_configure(struct scsi_device *sdev) ...@@ -1569,7 +1573,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
r_level, raid_device->handle, r_level, raid_device->handle,
(unsigned long long)raid_device->wwid, (unsigned long long)raid_device->wwid,
raid_device->num_pds, ds); raid_device->num_pds, ds);
_scsih_change_queue_depth(sdev, qdepth); _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT);
return 0; return 0;
} }
...@@ -1615,7 +1619,7 @@ _scsih_slave_configure(struct scsi_device *sdev) ...@@ -1615,7 +1619,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
_scsih_display_sata_capabilities(ioc, sas_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) if (ssp_target)
sas_read_port_mode_page(sdev); sas_read_port_mode_page(sdev);
......
...@@ -278,12 +278,17 @@ static void pmcraid_slave_destroy(struct scsi_device *scsi_dev) ...@@ -278,12 +278,17 @@ static void pmcraid_slave_destroy(struct scsi_device *scsi_dev)
* pmcraid_change_queue_depth - Change the device's queue depth * pmcraid_change_queue_depth - Change the device's queue depth
* @scsi_dev: scsi device struct * @scsi_dev: scsi device struct
* @depth: depth to set * @depth: depth to set
* @reason: calling context
* *
* Return value * Return value
* actual depth set * 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) if (depth > PMCRAID_MAX_CMD_PER_LUN)
depth = PMCRAID_MAX_CMD_PER_LUN; depth = PMCRAID_MAX_CMD_PER_LUN;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment