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 <>

[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 <>
[jejb: fixed up 53c700]
Signed-off-by: default avatarJames Bottomley <>
parent dbf9bfe6
......@@ -138,7 +138,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 = {
......@@ -1235,8 +1235,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)
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
return sdev->queue_depth;
......@@ -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,
if (retval < 0)
return retval;
......@@ -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);
......@@ -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.
......@@ -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);
......@@ -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 *,
......@@ -43,6 +43,12 @@ struct blk_queue_tags;
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
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