diff options
27 files changed, 119 insertions, 32 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index b4ee28dec521..5d52c2fcd076 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1208,6 +1208,7 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev) | |||
1208 | * ata_scsi_change_queue_depth - SCSI callback for queue depth config | 1208 | * ata_scsi_change_queue_depth - SCSI callback for queue depth config |
1209 | * @sdev: SCSI device to configure queue depth for | 1209 | * @sdev: SCSI device to configure queue depth for |
1210 | * @queue_depth: new queue depth | 1210 | * @queue_depth: new queue depth |
1211 | * @reason: calling context | ||
1211 | * | 1212 | * |
1212 | * This is libata standard hostt->change_queue_depth callback. | 1213 | * This is libata standard hostt->change_queue_depth callback. |
1213 | * SCSI will call into this callback when user tries to set queue | 1214 | * 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 | * RETURNS: | 1220 | * RETURNS: |
1220 | * Newly configured queue depth. | 1221 | * Newly configured queue depth. |
1221 | */ | 1222 | */ |
1222 | int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth) | 1223 | int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth, |
1224 | int reason) | ||
1223 | { | 1225 | { |
1224 | struct ata_port *ap = ata_shost_to_port(sdev->host); | 1226 | struct ata_port *ap = ata_shost_to_port(sdev->host); |
1225 | struct ata_device *dev; | 1227 | struct ata_device *dev; |
1226 | unsigned long flags; | 1228 | unsigned long flags; |
1227 | 1229 | ||
1230 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
1231 | return -EOPNOTSUPP; | ||
1232 | |||
1228 | if (queue_depth < 1 || queue_depth == sdev->queue_depth) | 1233 | if (queue_depth < 1 || queue_depth == sdev->queue_depth) |
1229 | return sdev->queue_depth; | 1234 | return sdev->queue_depth; |
1230 | 1235 | ||
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 1eb4e020eb5c..0c82d335c55d 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -1975,7 +1975,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev) | |||
1975 | ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num)); | 1975 | ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num)); |
1976 | 1976 | ||
1977 | if (strncmp(model_num, "Maxtor", 6) == 0) { | 1977 | if (strncmp(model_num, "Maxtor", 6) == 0) { |
1978 | ata_scsi_change_queue_depth(sdev, 1); | 1978 | ata_scsi_change_queue_depth(sdev, 1, SCSI_QDEPTH_DEFAULT); |
1979 | ata_dev_printk(dev, KERN_NOTICE, | 1979 | ata_dev_printk(dev, KERN_NOTICE, |
1980 | "Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth); | 1980 | "Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth); |
1981 | } | 1981 | } |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index f68ec48a881e..57752751712b 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -2351,11 +2351,12 @@ mptscsih_slave_destroy(struct scsi_device *sdev) | |||
2351 | * mptscsih_change_queue_depth - This function will set a devices queue depth | 2351 | * mptscsih_change_queue_depth - This function will set a devices queue depth |
2352 | * @sdev: per scsi_device pointer | 2352 | * @sdev: per scsi_device pointer |
2353 | * @qdepth: requested queue depth | 2353 | * @qdepth: requested queue depth |
2354 | * @reason: calling context | ||
2354 | * | 2355 | * |
2355 | * Adding support for new 'change_queue_depth' api. | 2356 | * Adding support for new 'change_queue_depth' api. |
2356 | */ | 2357 | */ |
2357 | int | 2358 | int |
2358 | mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth) | 2359 | mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) |
2359 | { | 2360 | { |
2360 | MPT_SCSI_HOST *hd = shost_priv(sdev->host); | 2361 | MPT_SCSI_HOST *hd = shost_priv(sdev->host); |
2361 | VirtTarget *vtarget; | 2362 | VirtTarget *vtarget; |
@@ -2367,6 +2368,9 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth) | |||
2367 | starget = scsi_target(sdev); | 2368 | starget = scsi_target(sdev); |
2368 | vtarget = starget->hostdata; | 2369 | vtarget = starget->hostdata; |
2369 | 2370 | ||
2371 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
2372 | return -EOPNOTSUPP; | ||
2373 | |||
2370 | if (ioc->bus_type == SPI) { | 2374 | if (ioc->bus_type == SPI) { |
2371 | if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)) | 2375 | if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)) |
2372 | max_depth = 1; | 2376 | max_depth = 1; |
@@ -2433,7 +2437,8 @@ mptscsih_slave_configure(struct scsi_device *sdev) | |||
2433 | ioc->name, vtarget->negoFlags, vtarget->maxOffset, | 2437 | ioc->name, vtarget->negoFlags, vtarget->maxOffset, |
2434 | vtarget->minSyncFactor)); | 2438 | vtarget->minSyncFactor)); |
2435 | 2439 | ||
2436 | mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH); | 2440 | mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH, |
2441 | SCSI_QDEPTH_DEFAULT); | ||
2437 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT | 2442 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
2438 | "tagged %d, simple %d, ordered %d\n", | 2443 | "tagged %d, simple %d, ordered %d\n", |
2439 | ioc->name,sdev->tagged_supported, sdev->simple_tags, | 2444 | ioc->name,sdev->tagged_supported, sdev->simple_tags, |
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h index e0b33e04a33b..45a5ff3eff61 100644 --- a/drivers/message/fusion/mptscsih.h +++ b/drivers/message/fusion/mptscsih.h | |||
@@ -128,7 +128,8 @@ extern int mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_F | |||
128 | extern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); | 128 | extern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); |
129 | extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply); | 129 | extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply); |
130 | extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); | 130 | extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); |
131 | extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth); | 131 | extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth, |
132 | int reason); | ||
132 | extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id); | 133 | extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id); |
133 | extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id); | 134 | extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id); |
134 | extern struct device_attribute *mptscsih_host_attrs[]; | 135 | extern struct device_attribute *mptscsih_host_attrs[]; |
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 0e1a34627a2e..ad1154701729 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -29,8 +29,12 @@ char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *fcp_rsp_iu) | |||
29 | return fcp_sns_info_ptr; | 29 | return fcp_sns_info_ptr; |
30 | } | 30 | } |
31 | 31 | ||
32 | static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth) | 32 | static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth, |
33 | int reason) | ||
33 | { | 34 | { |
35 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
36 | return -EOPNOTSUPP; | ||
37 | |||
34 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); | 38 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); |
35 | return sdev->queue_depth; | 39 | return sdev->queue_depth; |
36 | } | 40 | } |
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 36c21b19e5d7..2d16d49fd3cd 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -186,8 +186,12 @@ static ssize_t twa_show_stats(struct device *dev, | |||
186 | } /* End twa_show_stats() */ | 186 | } /* End twa_show_stats() */ |
187 | 187 | ||
188 | /* This function will set a devices queue depth */ | 188 | /* This function will set a devices queue depth */ |
189 | static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth) | 189 | static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth, |
190 | int reason) | ||
190 | { | 191 | { |
192 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
193 | return -EOPNOTSUPP; | ||
194 | |||
191 | if (queue_depth > TW_Q_LENGTH-2) | 195 | if (queue_depth > TW_Q_LENGTH-2) |
192 | queue_depth = TW_Q_LENGTH-2; | 196 | queue_depth = TW_Q_LENGTH-2; |
193 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); | 197 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); |
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index faa0fcfed71e..d224294c38fb 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -521,8 +521,12 @@ static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr, | |||
521 | } /* End tw_show_stats() */ | 521 | } /* End tw_show_stats() */ |
522 | 522 | ||
523 | /* This function will set a devices queue depth */ | 523 | /* This function will set a devices queue depth */ |
524 | static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth) | 524 | static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth, |
525 | int reason) | ||
525 | { | 526 | { |
527 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
528 | return -EOPNOTSUPP; | ||
529 | |||
526 | if (queue_depth > TW_Q_LENGTH-2) | 530 | if (queue_depth > TW_Q_LENGTH-2) |
527 | queue_depth = TW_Q_LENGTH-2; | 531 | queue_depth = TW_Q_LENGTH-2; |
528 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); | 532 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); |
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index f5a9addb7050..6c60a8060c58 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
@@ -175,7 +175,7 @@ STATIC void NCR_700_chip_reset(struct Scsi_Host *host); | |||
175 | STATIC int NCR_700_slave_alloc(struct scsi_device *SDpnt); | 175 | STATIC int NCR_700_slave_alloc(struct scsi_device *SDpnt); |
176 | STATIC int NCR_700_slave_configure(struct scsi_device *SDpnt); | 176 | STATIC int NCR_700_slave_configure(struct scsi_device *SDpnt); |
177 | STATIC void NCR_700_slave_destroy(struct scsi_device *SDpnt); | 177 | STATIC void NCR_700_slave_destroy(struct scsi_device *SDpnt); |
178 | static int NCR_700_change_queue_depth(struct scsi_device *SDpnt, int depth); | 178 | static int NCR_700_change_queue_depth(struct scsi_device *SDpnt, int depth, int reason); |
179 | static int NCR_700_change_queue_type(struct scsi_device *SDpnt, int depth); | 179 | static int NCR_700_change_queue_type(struct scsi_device *SDpnt, int depth); |
180 | 180 | ||
181 | STATIC struct device_attribute *NCR_700_dev_attrs[]; | 181 | STATIC struct device_attribute *NCR_700_dev_attrs[]; |
@@ -2082,8 +2082,11 @@ NCR_700_slave_destroy(struct scsi_device *SDp) | |||
2082 | } | 2082 | } |
2083 | 2083 | ||
2084 | static int | 2084 | static int |
2085 | NCR_700_change_queue_depth(struct scsi_device *SDp, int depth) | 2085 | NCR_700_change_queue_depth(struct scsi_device *SDp, int depth, int reason) |
2086 | { | 2086 | { |
2087 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
2088 | return -EOPNOTSUPP; | ||
2089 | |||
2087 | if (depth > NCR_700_MAX_TAGS) | 2090 | if (depth > NCR_700_MAX_TAGS) |
2088 | depth = NCR_700_MAX_TAGS; | 2091 | depth = NCR_700_MAX_TAGS; |
2089 | 2092 | ||
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 9b97c3e016fe..e9373a2d14fa 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -472,8 +472,12 @@ static int aac_slave_configure(struct scsi_device *sdev) | |||
472 | * total capacity and the queue depth supported by the target device. | 472 | * total capacity and the queue depth supported by the target device. |
473 | */ | 473 | */ |
474 | 474 | ||
475 | static int aac_change_queue_depth(struct scsi_device *sdev, int depth) | 475 | static int aac_change_queue_depth(struct scsi_device *sdev, int depth, |
476 | int reason) | ||
476 | { | 477 | { |
478 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
479 | return -EOPNOTSUPP; | ||
480 | |||
477 | if (sdev->tagged_supported && (sdev->type == TYPE_DISK) && | 481 | if (sdev->tagged_supported && (sdev->type == TYPE_DISK) && |
478 | (sdev_channel(sdev) == CONTAINER_CHANNEL)) { | 482 | (sdev_channel(sdev) == CONTAINER_CHANNEL)) { |
479 | struct scsi_device * dev; | 483 | struct scsi_device * dev; |
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 80aac01b5a6f..47d5d19f8c92 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c | |||
@@ -98,8 +98,11 @@ static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb); | |||
98 | static const char *arcmsr_info(struct Scsi_Host *); | 98 | static const char *arcmsr_info(struct Scsi_Host *); |
99 | static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb); | 99 | static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb); |
100 | static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev, | 100 | static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev, |
101 | int queue_depth) | 101 | int queue_depth, int reason) |
102 | { | 102 | { |
103 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
104 | return -EOPNOTSUPP; | ||
105 | |||
103 | if (queue_depth > ARCMSR_MAX_CMD_PERLUN) | 106 | if (queue_depth > ARCMSR_MAX_CMD_PERLUN) |
104 | queue_depth = ARCMSR_MAX_CMD_PERLUN; | 107 | queue_depth = ARCMSR_MAX_CMD_PERLUN; |
105 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); | 108 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); |
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index a0e7e711ff9d..901a3daeb36b 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c | |||
@@ -861,10 +861,13 @@ static int hptiop_reset(struct scsi_cmnd *scp) | |||
861 | } | 861 | } |
862 | 862 | ||
863 | static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev, | 863 | static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev, |
864 | int queue_depth) | 864 | int queue_depth, int reason) |
865 | { | 865 | { |
866 | struct hptiop_hba *hba = (struct hptiop_hba *)sdev->host->hostdata; | 866 | struct hptiop_hba *hba = (struct hptiop_hba *)sdev->host->hostdata; |
867 | 867 | ||
868 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
869 | return -EOPNOTSUPP; | ||
870 | |||
868 | if (queue_depth > hba->max_requests) | 871 | if (queue_depth > hba->max_requests) |
869 | queue_depth = hba->max_requests; | 872 | queue_depth = hba->max_requests; |
870 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); | 873 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); |
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index bc9beb8c587c..87b536a97cb4 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c | |||
@@ -2764,12 +2764,17 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev) | |||
2764 | * ibmvfc_change_queue_depth - Change the device's queue depth | 2764 | * ibmvfc_change_queue_depth - Change the device's queue depth |
2765 | * @sdev: scsi device struct | 2765 | * @sdev: scsi device struct |
2766 | * @qdepth: depth to set | 2766 | * @qdepth: depth to set |
2767 | * @reason: calling context | ||
2767 | * | 2768 | * |
2768 | * Return value: | 2769 | * Return value: |
2769 | * actual depth set | 2770 | * actual depth set |
2770 | **/ | 2771 | **/ |
2771 | static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth) | 2772 | static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth, |
2773 | int reason) | ||
2772 | { | 2774 | { |
2775 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
2776 | return -EOPNOTSUPP; | ||
2777 | |||
2773 | if (qdepth > IBMVFC_MAX_CMDS_PER_LUN) | 2778 | if (qdepth > IBMVFC_MAX_CMDS_PER_LUN) |
2774 | qdepth = IBMVFC_MAX_CMDS_PER_LUN; | 2779 | qdepth = IBMVFC_MAX_CMDS_PER_LUN; |
2775 | 2780 | ||
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index d9b0e9d31983..e475b7957c2d 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -1637,12 +1637,17 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev) | |||
1637 | * ibmvscsi_change_queue_depth - Change the device's queue depth | 1637 | * ibmvscsi_change_queue_depth - Change the device's queue depth |
1638 | * @sdev: scsi device struct | 1638 | * @sdev: scsi device struct |
1639 | * @qdepth: depth to set | 1639 | * @qdepth: depth to set |
1640 | * @reason: calling context | ||
1640 | * | 1641 | * |
1641 | * Return value: | 1642 | * Return value: |
1642 | * actual depth set | 1643 | * actual depth set |
1643 | **/ | 1644 | **/ |
1644 | static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth) | 1645 | static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth, |
1646 | int reason) | ||
1645 | { | 1647 | { |
1648 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
1649 | return -EOPNOTSUPP; | ||
1650 | |||
1646 | if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN) | 1651 | if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN) |
1647 | qdepth = IBMVSCSI_MAX_CMDS_PER_LUN; | 1652 | qdepth = IBMVSCSI_MAX_CMDS_PER_LUN; |
1648 | 1653 | ||
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 5f045505a1f4..d40d5c79fff1 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -3367,16 +3367,21 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) { return 0; }; | |||
3367 | * ipr_change_queue_depth - Change the device's queue depth | 3367 | * ipr_change_queue_depth - Change the device's queue depth |
3368 | * @sdev: scsi device struct | 3368 | * @sdev: scsi device struct |
3369 | * @qdepth: depth to set | 3369 | * @qdepth: depth to set |
3370 | * @reason: calling context | ||
3370 | * | 3371 | * |
3371 | * Return value: | 3372 | * Return value: |
3372 | * actual depth set | 3373 | * actual depth set |
3373 | **/ | 3374 | **/ |
3374 | static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth) | 3375 | static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth, |
3376 | int reason) | ||
3375 | { | 3377 | { |
3376 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata; | 3378 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata; |
3377 | struct ipr_resource_entry *res; | 3379 | struct ipr_resource_entry *res; |
3378 | unsigned long lock_flags = 0; | 3380 | unsigned long lock_flags = 0; |
3379 | 3381 | ||
3382 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
3383 | return -EOPNOTSUPP; | ||
3384 | |||
3380 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | 3385 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
3381 | res = (struct ipr_resource_entry *)sdev->hostdata; | 3386 | res = (struct ipr_resource_entry *)sdev->hostdata; |
3382 | 3387 | ||
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index a67f53a5026c..beaab818d8de 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c | |||
@@ -2064,8 +2064,11 @@ int fc_slave_alloc(struct scsi_device *sdev) | |||
2064 | } | 2064 | } |
2065 | EXPORT_SYMBOL(fc_slave_alloc); | 2065 | EXPORT_SYMBOL(fc_slave_alloc); |
2066 | 2066 | ||
2067 | int fc_change_queue_depth(struct scsi_device *sdev, int qdepth) | 2067 | int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) |
2068 | { | 2068 | { |
2069 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
2070 | return -EOPNOTSUPP; | ||
2071 | |||
2069 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); | 2072 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); |
2070 | return sdev->queue_depth; | 2073 | return sdev->queue_depth; |
2071 | } | 2074 | } |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index f1a4246f890c..67d0f3fc8ac0 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -1643,8 +1643,11 @@ fault: | |||
1643 | } | 1643 | } |
1644 | EXPORT_SYMBOL_GPL(iscsi_queuecommand); | 1644 | EXPORT_SYMBOL_GPL(iscsi_queuecommand); |
1645 | 1645 | ||
1646 | int iscsi_change_queue_depth(struct scsi_device *sdev, int depth) | 1646 | int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason) |
1647 | { | 1647 | { |
1648 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
1649 | return -EOPNOTSUPP; | ||
1650 | |||
1648 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); | 1651 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); |
1649 | return sdev->queue_depth; | 1652 | return sdev->queue_depth; |
1650 | } | 1653 | } |
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 1c558d3bce18..14b13196b22d 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c | |||
@@ -820,10 +820,14 @@ void sas_slave_destroy(struct scsi_device *scsi_dev) | |||
820 | ata_port_disable(dev->sata_dev.ap); | 820 | ata_port_disable(dev->sata_dev.ap); |
821 | } | 821 | } |
822 | 822 | ||
823 | int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth) | 823 | int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth, |
824 | int reason) | ||
824 | { | 825 | { |
825 | int res = min(new_depth, SAS_MAX_QD); | 826 | int res = min(new_depth, SAS_MAX_QD); |
826 | 827 | ||
828 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
829 | return -EOPNOTSUPP; | ||
830 | |||
827 | if (scsi_dev->tagged_supported) | 831 | if (scsi_dev->tagged_supported) |
828 | scsi_adjust_queue_depth(scsi_dev, scsi_get_tag_type(scsi_dev), | 832 | scsi_adjust_queue_depth(scsi_dev, scsi_get_tag_type(scsi_dev), |
829 | res); | 833 | res); |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index 234f0b7eb21c..fd181c2a8ae4 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -335,12 +335,17 @@ static struct device_attribute *megaraid_sdev_attrs[] = { | |||
335 | * megaraid_change_queue_depth - Change the device's queue depth | 335 | * megaraid_change_queue_depth - Change the device's queue depth |
336 | * @sdev: scsi device struct | 336 | * @sdev: scsi device struct |
337 | * @qdepth: depth to set | 337 | * @qdepth: depth to set |
338 | * @reason: calling context | ||
338 | * | 339 | * |
339 | * Return value: | 340 | * Return value: |
340 | * actual depth set | 341 | * actual depth set |
341 | */ | 342 | */ |
342 | static int megaraid_change_queue_depth(struct scsi_device *sdev, int qdepth) | 343 | static int megaraid_change_queue_depth(struct scsi_device *sdev, int qdepth, |
344 | int reason) | ||
343 | { | 345 | { |
346 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
347 | return -EOPNOTSUPP; | ||
348 | |||
344 | if (qdepth > MBOX_MAX_SCSI_CMDS) | 349 | if (qdepth > MBOX_MAX_SCSI_CMDS) |
345 | qdepth = MBOX_MAX_SCSI_CMDS; | 350 | qdepth = MBOX_MAX_SCSI_CMDS; |
346 | scsi_adjust_queue_depth(sdev, 0, qdepth); | 351 | scsi_adjust_queue_depth(sdev, 0, qdepth); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 8dc682f00fd2..55ee014a7e08 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
@@ -1099,11 +1099,12 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc, | |||
1099 | * _scsih_change_queue_depth - setting device queue depth | 1099 | * _scsih_change_queue_depth - setting device queue depth |
1100 | * @sdev: scsi device struct | 1100 | * @sdev: scsi device struct |
1101 | * @qdepth: requested queue depth | 1101 | * @qdepth: requested queue depth |
1102 | * @reason: calling context | ||
1102 | * | 1103 | * |
1103 | * Returns queue depth. | 1104 | * Returns queue depth. |
1104 | */ | 1105 | */ |
1105 | static int | 1106 | static int |
1106 | _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth) | 1107 | _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) |
1107 | { | 1108 | { |
1108 | struct Scsi_Host *shost = sdev->host; | 1109 | struct Scsi_Host *shost = sdev->host; |
1109 | int max_depth; | 1110 | int max_depth; |
@@ -1114,6 +1115,9 @@ _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth) | |||
1114 | struct _sas_device *sas_device; | 1115 | struct _sas_device *sas_device; |
1115 | unsigned long flags; | 1116 | unsigned long flags; |
1116 | 1117 | ||
1118 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
1119 | return -EOPNOTSUPP; | ||
1120 | |||
1117 | max_depth = shost->can_queue; | 1121 | max_depth = shost->can_queue; |
1118 | 1122 | ||
1119 | /* limit max device queue for SATA to 32 */ | 1123 | /* limit max device queue for SATA to 32 */ |
@@ -1569,7 +1573,7 @@ _scsih_slave_configure(struct scsi_device *sdev) | |||
1569 | r_level, raid_device->handle, | 1573 | r_level, raid_device->handle, |
1570 | (unsigned long long)raid_device->wwid, | 1574 | (unsigned long long)raid_device->wwid, |
1571 | raid_device->num_pds, ds); | 1575 | raid_device->num_pds, ds); |
1572 | _scsih_change_queue_depth(sdev, qdepth); | 1576 | _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT); |
1573 | return 0; | 1577 | return 0; |
1574 | } | 1578 | } |
1575 | 1579 | ||
@@ -1615,7 +1619,7 @@ _scsih_slave_configure(struct scsi_device *sdev) | |||
1615 | _scsih_display_sata_capabilities(ioc, sas_device, sdev); | 1619 | _scsih_display_sata_capabilities(ioc, sas_device, sdev); |
1616 | } | 1620 | } |
1617 | 1621 | ||
1618 | _scsih_change_queue_depth(sdev, qdepth); | 1622 | _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT); |
1619 | 1623 | ||
1620 | if (ssp_target) | 1624 | if (ssp_target) |
1621 | sas_read_port_mode_page(sdev); | 1625 | sas_read_port_mode_page(sdev); |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index f7c70e2a8224..86d158ee3572 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -278,12 +278,17 @@ static void pmcraid_slave_destroy(struct scsi_device *scsi_dev) | |||
278 | * pmcraid_change_queue_depth - Change the device's queue depth | 278 | * pmcraid_change_queue_depth - Change the device's queue depth |
279 | * @scsi_dev: scsi device struct | 279 | * @scsi_dev: scsi device struct |
280 | * @depth: depth to set | 280 | * @depth: depth to set |
281 | * @reason: calling context | ||
281 | * | 282 | * |
282 | * Return value | 283 | * Return value |
283 | * actual depth set | 284 | * actual depth set |
284 | */ | 285 | */ |
285 | static int pmcraid_change_queue_depth(struct scsi_device *scsi_dev, int depth) | 286 | static int pmcraid_change_queue_depth(struct scsi_device *scsi_dev, int depth, |
287 | int reason) | ||
286 | { | 288 | { |
289 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
290 | return -EOPNOTSUPP; | ||
291 | |||
287 | if (depth > PMCRAID_MAX_CMD_PER_LUN) | 292 | if (depth > PMCRAID_MAX_CMD_PER_LUN) |
288 | depth = PMCRAID_MAX_CMD_PER_LUN; | 293 | depth = PMCRAID_MAX_CMD_PER_LUN; |
289 | 294 | ||
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index ecf2a40d70be..d69744a62fe4 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -138,7 +138,7 @@ static int qla2xxx_eh_target_reset(struct scsi_cmnd *); | |||
138 | static int qla2xxx_eh_bus_reset(struct scsi_cmnd *); | 138 | static int qla2xxx_eh_bus_reset(struct scsi_cmnd *); |
139 | static int qla2xxx_eh_host_reset(struct scsi_cmnd *); | 139 | static int qla2xxx_eh_host_reset(struct scsi_cmnd *); |
140 | 140 | ||
141 | static int qla2x00_change_queue_depth(struct scsi_device *, int); | 141 | static int qla2x00_change_queue_depth(struct scsi_device *, int, int); |
142 | static int qla2x00_change_queue_type(struct scsi_device *, int); | 142 | static int qla2x00_change_queue_type(struct scsi_device *, int); |
143 | 143 | ||
144 | struct scsi_host_template qla2xxx_driver_template = { | 144 | struct scsi_host_template qla2xxx_driver_template = { |
@@ -1235,8 +1235,11 @@ qla2xxx_slave_destroy(struct scsi_device *sdev) | |||
1235 | } | 1235 | } |
1236 | 1236 | ||
1237 | static int | 1237 | static int |
1238 | qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth) | 1238 | qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) |
1239 | { | 1239 | { |
1240 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
1241 | return -EOPNOTSUPP; | ||
1242 | |||
1240 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); | 1243 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); |
1241 | return sdev->queue_depth; | 1244 | return sdev->queue_depth; |
1242 | } | 1245 | } |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 5c7eb63a19d1..a48782866b22 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -766,7 +766,8 @@ sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr, | |||
766 | if (depth < 1) | 766 | if (depth < 1) |
767 | return -EINVAL; | 767 | return -EINVAL; |
768 | 768 | ||
769 | retval = sht->change_queue_depth(sdev, depth); | 769 | retval = sht->change_queue_depth(sdev, depth, |
770 | SCSI_QDEPTH_DEFAULT); | ||
770 | if (retval < 0) | 771 | if (retval < 0) |
771 | return retval; | 772 | return retval; |
772 | 773 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 87698640c091..85df383fd4bd 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -1023,7 +1023,7 @@ extern int ata_std_bios_param(struct scsi_device *sdev, | |||
1023 | extern int ata_scsi_slave_config(struct scsi_device *sdev); | 1023 | extern int ata_scsi_slave_config(struct scsi_device *sdev); |
1024 | extern void ata_scsi_slave_destroy(struct scsi_device *sdev); | 1024 | extern void ata_scsi_slave_destroy(struct scsi_device *sdev); |
1025 | extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, | 1025 | extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, |
1026 | int queue_depth); | 1026 | int queue_depth, int reason); |
1027 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); | 1027 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); |
1028 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); | 1028 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); |
1029 | 1029 | ||
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 1662d73d85a7..9617f9365e45 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -919,7 +919,7 @@ int fc_slave_alloc(struct scsi_device *sdev); | |||
919 | /* | 919 | /* |
920 | * Adjust the queue depth. | 920 | * Adjust the queue depth. |
921 | */ | 921 | */ |
922 | int fc_change_queue_depth(struct scsi_device *sdev, int qdepth); | 922 | int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason); |
923 | 923 | ||
924 | /* | 924 | /* |
925 | * Change the tag type. | 925 | * Change the tag type. |
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index a72edd4eceec..2db2bc26b1e9 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -333,7 +333,8 @@ struct iscsi_host { | |||
333 | /* | 333 | /* |
334 | * scsi host template | 334 | * scsi host template |
335 | */ | 335 | */ |
336 | extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth); | 336 | extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, |
337 | int reason); | ||
337 | extern int iscsi_eh_abort(struct scsi_cmnd *sc); | 338 | extern int iscsi_eh_abort(struct scsi_cmnd *sc); |
338 | extern int iscsi_eh_target_reset(struct scsi_cmnd *sc); | 339 | extern int iscsi_eh_target_reset(struct scsi_cmnd *sc); |
339 | extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); | 340 | extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); |
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index e78d3b62d8ec..9eaa3f05f954 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h | |||
@@ -634,7 +634,8 @@ extern int sas_target_alloc(struct scsi_target *); | |||
634 | extern int sas_slave_alloc(struct scsi_device *); | 634 | extern int sas_slave_alloc(struct scsi_device *); |
635 | extern int sas_slave_configure(struct scsi_device *); | 635 | extern int sas_slave_configure(struct scsi_device *); |
636 | extern void sas_slave_destroy(struct scsi_device *); | 636 | extern void sas_slave_destroy(struct scsi_device *); |
637 | extern int sas_change_queue_depth(struct scsi_device *, int new_depth); | 637 | extern int sas_change_queue_depth(struct scsi_device *, int new_depth, |
638 | int reason); | ||
638 | extern int sas_change_queue_type(struct scsi_device *, int qt); | 639 | extern int sas_change_queue_type(struct scsi_device *, int qt); |
639 | extern int sas_bios_param(struct scsi_device *, | 640 | extern int sas_bios_param(struct scsi_device *, |
640 | struct block_device *, | 641 | struct block_device *, |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 6e728b176904..603054d8f40c 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -43,6 +43,12 @@ struct blk_queue_tags; | |||
43 | #define DISABLE_CLUSTERING 0 | 43 | #define DISABLE_CLUSTERING 0 |
44 | #define ENABLE_CLUSTERING 1 | 44 | #define ENABLE_CLUSTERING 1 |
45 | 45 | ||
46 | enum { | ||
47 | SCSI_QDEPTH_DEFAULT, /* default requested change, e.g. from sysfs */ | ||
48 | SCSI_QDEPTH_QFULL, /* scsi-ml requested due to queue full */ | ||
49 | SCSI_QDEPTH_RAMP_UP, /* scsi-ml requested due to threshhold event */ | ||
50 | }; | ||
51 | |||
46 | struct scsi_host_template { | 52 | struct scsi_host_template { |
47 | struct module *module; | 53 | struct module *module; |
48 | const char *name; | 54 | const char *name; |
@@ -294,7 +300,7 @@ struct scsi_host_template { | |||
294 | * | 300 | * |
295 | * Status: OPTIONAL | 301 | * Status: OPTIONAL |
296 | */ | 302 | */ |
297 | int (* change_queue_depth)(struct scsi_device *, int); | 303 | int (* change_queue_depth)(struct scsi_device *, int, int); |
298 | 304 | ||
299 | /* | 305 | /* |
300 | * Fill in this function to allow the changing of tag types | 306 | * Fill in this function to allow the changing of tag types |