diff options
30 files changed, 73 insertions, 244 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index f42ab14105ac..812a2891de58 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
@@ -922,6 +922,7 @@ static struct scsi_host_template iscsi_iser_sht = { | |||
922 | .use_clustering = DISABLE_CLUSTERING, | 922 | .use_clustering = DISABLE_CLUSTERING, |
923 | .proc_name = "iscsi_iser", | 923 | .proc_name = "iscsi_iser", |
924 | .this_id = -1, | 924 | .this_id = -1, |
925 | .track_queue_depth = 1, | ||
925 | }; | 926 | }; |
926 | 927 | ||
927 | static struct iscsi_transport iscsi_iser_transport = { | 928 | static struct iscsi_transport iscsi_iser_transport = { |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 57b5ff1bbcb6..98a303558930 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -2402,7 +2402,7 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event) | |||
2402 | * srp_change_queue_depth - setting device queue depth | 2402 | * srp_change_queue_depth - setting device queue depth |
2403 | * @sdev: scsi device struct | 2403 | * @sdev: scsi device struct |
2404 | * @qdepth: requested queue depth | 2404 | * @qdepth: requested queue depth |
2405 | * @reason: SCSI_QDEPTH_DEFAULT/SCSI_QDEPTH_QFULL/SCSI_QDEPTH_RAMP_UP | 2405 | * @reason: SCSI_QDEPTH_DEFAULT |
2406 | * (see include/scsi/scsi_host.h for definition) | 2406 | * (see include/scsi/scsi_host.h for definition) |
2407 | * | 2407 | * |
2408 | * Returns queue depth. | 2408 | * Returns queue depth. |
@@ -2412,18 +2412,13 @@ srp_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) | |||
2412 | { | 2412 | { |
2413 | struct Scsi_Host *shost = sdev->host; | 2413 | struct Scsi_Host *shost = sdev->host; |
2414 | int max_depth; | 2414 | int max_depth; |
2415 | if (reason == SCSI_QDEPTH_DEFAULT || reason == SCSI_QDEPTH_RAMP_UP) { | ||
2416 | max_depth = shost->can_queue; | ||
2417 | if (!sdev->tagged_supported) | ||
2418 | max_depth = 1; | ||
2419 | if (qdepth > max_depth) | ||
2420 | qdepth = max_depth; | ||
2421 | scsi_adjust_queue_depth(sdev, qdepth); | ||
2422 | } else if (reason == SCSI_QDEPTH_QFULL) | ||
2423 | scsi_track_queue_full(sdev, qdepth); | ||
2424 | else | ||
2425 | return -EOPNOTSUPP; | ||
2426 | 2415 | ||
2416 | max_depth = shost->can_queue; | ||
2417 | if (!sdev->tagged_supported) | ||
2418 | max_depth = 1; | ||
2419 | if (qdepth > max_depth) | ||
2420 | qdepth = max_depth; | ||
2421 | scsi_adjust_queue_depth(sdev, qdepth); | ||
2427 | return sdev->queue_depth; | 2422 | return sdev->queue_depth; |
2428 | } | 2423 | } |
2429 | 2424 | ||
@@ -2766,6 +2761,7 @@ static struct scsi_host_template srp_template = { | |||
2766 | .use_clustering = ENABLE_CLUSTERING, | 2761 | .use_clustering = ENABLE_CLUSTERING, |
2767 | .shost_attrs = srp_host_attrs, | 2762 | .shost_attrs = srp_host_attrs, |
2768 | .use_blk_tags = 1, | 2763 | .use_blk_tags = 1, |
2764 | .track_queue_depth = 1, | ||
2769 | }; | 2765 | }; |
2770 | 2766 | ||
2771 | static int srp_sdev_count(struct Scsi_Host *host) | 2767 | static int srp_sdev_count(struct Scsi_Host *host) |
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index b5dfa51f396f..179bf3d8af6c 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -35,19 +35,7 @@ MODULE_PARM_DESC(allow_lun_scan, "For NPIV, scan and attach all storage LUNs"); | |||
35 | static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth, | 35 | static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth, |
36 | int reason) | 36 | int reason) |
37 | { | 37 | { |
38 | switch (reason) { | 38 | scsi_adjust_queue_depth(sdev, depth); |
39 | case SCSI_QDEPTH_DEFAULT: | ||
40 | scsi_adjust_queue_depth(sdev, depth); | ||
41 | break; | ||
42 | case SCSI_QDEPTH_QFULL: | ||
43 | scsi_track_queue_full(sdev, depth); | ||
44 | break; | ||
45 | case SCSI_QDEPTH_RAMP_UP: | ||
46 | scsi_adjust_queue_depth(sdev, depth); | ||
47 | break; | ||
48 | default: | ||
49 | return -EOPNOTSUPP; | ||
50 | } | ||
51 | return sdev->queue_depth; | 39 | return sdev->queue_depth; |
52 | } | 40 | } |
53 | 41 | ||
@@ -320,6 +308,7 @@ static struct scsi_host_template zfcp_scsi_host_template = { | |||
320 | .use_clustering = 1, | 308 | .use_clustering = 1, |
321 | .shost_attrs = zfcp_sysfs_shost_attrs, | 309 | .shost_attrs = zfcp_sysfs_shost_attrs, |
322 | .sdev_attrs = zfcp_sysfs_sdev_attrs, | 310 | .sdev_attrs = zfcp_sysfs_sdev_attrs, |
311 | .track_queue_depth = 1, | ||
323 | }; | 312 | }; |
324 | 313 | ||
325 | /** | 314 | /** |
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index 579dc2f460c4..a64cf932d03d 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c | |||
@@ -84,6 +84,7 @@ static struct scsi_host_template aic94xx_sht = { | |||
84 | .target_destroy = sas_target_destroy, | 84 | .target_destroy = sas_target_destroy, |
85 | .ioctl = sas_ioctl, | 85 | .ioctl = sas_ioctl, |
86 | .use_blk_tags = 1, | 86 | .use_blk_tags = 1, |
87 | .track_queue_depth = 1, | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | static int asd_map_memio(struct asd_ha_struct *asd_ha) | 90 | static int asd_map_memio(struct asd_ha_struct *asd_ha) |
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 30d74a06b993..d9b999a3416f 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -570,7 +570,7 @@ static struct scsi_host_template beiscsi_sht = { | |||
570 | .cmd_per_lun = BEISCSI_CMD_PER_LUN, | 570 | .cmd_per_lun = BEISCSI_CMD_PER_LUN, |
571 | .use_clustering = ENABLE_CLUSTERING, | 571 | .use_clustering = ENABLE_CLUSTERING, |
572 | .vendor_id = SCSI_NL_VID_TYPE_PCI | BE_VENDOR_ID, | 572 | .vendor_id = SCSI_NL_VID_TYPE_PCI | BE_VENDOR_ID, |
573 | 573 | .track_queue_depth = 1, | |
574 | }; | 574 | }; |
575 | 575 | ||
576 | static struct scsi_transport_template *beiscsi_scsi_transport; | 576 | static struct scsi_transport_template *beiscsi_scsi_transport; |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index 2262c75f45d8..cc537972f3ea 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |||
@@ -2792,6 +2792,7 @@ static struct scsi_host_template bnx2fc_shost_template = { | |||
2792 | .sg_tablesize = BNX2FC_MAX_BDS_PER_CMD, | 2792 | .sg_tablesize = BNX2FC_MAX_BDS_PER_CMD, |
2793 | .max_sectors = 1024, | 2793 | .max_sectors = 1024, |
2794 | .use_blk_tags = 1, | 2794 | .use_blk_tags = 1, |
2795 | .track_queue_depth = 1, | ||
2795 | }; | 2796 | }; |
2796 | 2797 | ||
2797 | static struct libfc_function_template bnx2fc_libfc_fcn_templ = { | 2798 | static struct libfc_function_template bnx2fc_libfc_fcn_templ = { |
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 7a36388822aa..9de1c20bb0f8 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c | |||
@@ -2268,6 +2268,7 @@ static struct scsi_host_template bnx2i_host_template = { | |||
2268 | .use_clustering = ENABLE_CLUSTERING, | 2268 | .use_clustering = ENABLE_CLUSTERING, |
2269 | .sg_tablesize = ISCSI_MAX_BDS_PER_CMD, | 2269 | .sg_tablesize = ISCSI_MAX_BDS_PER_CMD, |
2270 | .shost_attrs = bnx2i_dev_attributes, | 2270 | .shost_attrs = bnx2i_dev_attributes, |
2271 | .track_queue_depth = 1, | ||
2271 | }; | 2272 | }; |
2272 | 2273 | ||
2273 | struct iscsi_transport bnx2i_iscsi_transport = { | 2274 | struct iscsi_transport bnx2i_iscsi_transport = { |
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c index 49692a1ac44a..99ea67dcdd2a 100644 --- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c +++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | |||
@@ -96,6 +96,7 @@ static struct scsi_host_template cxgb3i_host_template = { | |||
96 | .target_alloc = iscsi_target_alloc, | 96 | .target_alloc = iscsi_target_alloc, |
97 | .use_clustering = DISABLE_CLUSTERING, | 97 | .use_clustering = DISABLE_CLUSTERING, |
98 | .this_id = -1, | 98 | .this_id = -1, |
99 | .track_queue_depth = 1, | ||
99 | }; | 100 | }; |
100 | 101 | ||
101 | static struct iscsi_transport cxgb3i_iscsi_transport = { | 102 | static struct iscsi_transport cxgb3i_iscsi_transport = { |
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 81bb3bd7909d..af86e8f57b84 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | |||
@@ -99,6 +99,7 @@ static struct scsi_host_template cxgb4i_host_template = { | |||
99 | .target_alloc = iscsi_target_alloc, | 99 | .target_alloc = iscsi_target_alloc, |
100 | .use_clustering = DISABLE_CLUSTERING, | 100 | .use_clustering = DISABLE_CLUSTERING, |
101 | .this_id = -1, | 101 | .this_id = -1, |
102 | .track_queue_depth = 1, | ||
102 | }; | 103 | }; |
103 | 104 | ||
104 | static struct iscsi_transport cxgb4i_iscsi_transport = { | 105 | static struct iscsi_transport cxgb4i_iscsi_transport = { |
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index a3eeb6842499..97229860398f 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -289,6 +289,7 @@ static struct scsi_host_template fcoe_shost_template = { | |||
289 | .sg_tablesize = SG_ALL, | 289 | .sg_tablesize = SG_ALL, |
290 | .max_sectors = 0xffff, | 290 | .max_sectors = 0xffff, |
291 | .use_blk_tags = 1, | 291 | .use_blk_tags = 1, |
292 | .track_queue_depth = 1, | ||
292 | }; | 293 | }; |
293 | 294 | ||
294 | /** | 295 | /** |
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index 1e5706ed9a40..86b496c8633d 100644 --- a/drivers/scsi/fnic/fnic_main.c +++ b/drivers/scsi/fnic/fnic_main.c | |||
@@ -120,6 +120,7 @@ static struct scsi_host_template fnic_host_template = { | |||
120 | .max_sectors = 0xffff, | 120 | .max_sectors = 0xffff, |
121 | .shost_attrs = fnic_attrs, | 121 | .shost_attrs = fnic_attrs, |
122 | .use_blk_tags = 1, | 122 | .use_blk_tags = 1, |
123 | .track_queue_depth = 1, | ||
123 | }; | 124 | }; |
124 | 125 | ||
125 | static void | 126 | static void |
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 147b80e07b00..381449d5be76 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c | |||
@@ -3103,6 +3103,7 @@ static struct scsi_host_template driver_template = { | |||
3103 | .use_clustering = ENABLE_CLUSTERING, | 3103 | .use_clustering = ENABLE_CLUSTERING, |
3104 | .shost_attrs = ibmvfc_attrs, | 3104 | .shost_attrs = ibmvfc_attrs, |
3105 | .use_blk_tags = 1, | 3105 | .use_blk_tags = 1, |
3106 | .track_queue_depth = 1, | ||
3106 | }; | 3107 | }; |
3107 | 3108 | ||
3108 | /** | 3109 | /** |
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c index 897562056018..a81e546595dd 100644 --- a/drivers/scsi/isci/init.c +++ b/drivers/scsi/isci/init.c | |||
@@ -173,6 +173,7 @@ static struct scsi_host_template isci_sht = { | |||
173 | .ioctl = sas_ioctl, | 173 | .ioctl = sas_ioctl, |
174 | .shost_attrs = isci_host_attrs, | 174 | .shost_attrs = isci_host_attrs, |
175 | .use_blk_tags = 1, | 175 | .use_blk_tags = 1, |
176 | .track_queue_depth = 1, | ||
176 | }; | 177 | }; |
177 | 178 | ||
178 | static struct sas_domain_function_template isci_transport_ops = { | 179 | static struct sas_domain_function_template isci_transport_ops = { |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 427af0f24b0f..a575d845b667 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -966,6 +966,7 @@ static struct scsi_host_template iscsi_sw_tcp_sht = { | |||
966 | .target_alloc = iscsi_target_alloc, | 966 | .target_alloc = iscsi_target_alloc, |
967 | .proc_name = "iscsi_tcp", | 967 | .proc_name = "iscsi_tcp", |
968 | .this_id = -1, | 968 | .this_id = -1, |
969 | .track_queue_depth = 1, | ||
969 | }; | 970 | }; |
970 | 971 | ||
971 | static struct iscsi_transport iscsi_sw_tcp_transport = { | 972 | static struct iscsi_transport iscsi_sw_tcp_transport = { |
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index bf954ee050f8..0d2d024e77c5 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c | |||
@@ -2173,19 +2173,7 @@ EXPORT_SYMBOL(fc_slave_alloc); | |||
2173 | */ | 2173 | */ |
2174 | int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) | 2174 | int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) |
2175 | { | 2175 | { |
2176 | switch (reason) { | 2176 | scsi_adjust_queue_depth(sdev, qdepth); |
2177 | case SCSI_QDEPTH_DEFAULT: | ||
2178 | scsi_adjust_queue_depth(sdev, qdepth); | ||
2179 | break; | ||
2180 | case SCSI_QDEPTH_QFULL: | ||
2181 | scsi_track_queue_full(sdev, qdepth); | ||
2182 | break; | ||
2183 | case SCSI_QDEPTH_RAMP_UP: | ||
2184 | scsi_adjust_queue_depth(sdev, qdepth); | ||
2185 | break; | ||
2186 | default: | ||
2187 | return -EOPNOTSUPP; | ||
2188 | } | ||
2189 | return sdev->queue_depth; | 2177 | return sdev->queue_depth; |
2190 | } | 2178 | } |
2191 | EXPORT_SYMBOL(fc_change_queue_depth); | 2179 | EXPORT_SYMBOL(fc_change_queue_depth); |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index d521624dedfb..79e977484ad5 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -1773,19 +1773,7 @@ EXPORT_SYMBOL_GPL(iscsi_queuecommand); | |||
1773 | 1773 | ||
1774 | int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason) | 1774 | int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason) |
1775 | { | 1775 | { |
1776 | switch (reason) { | 1776 | scsi_adjust_queue_depth(sdev, depth); |
1777 | case SCSI_QDEPTH_DEFAULT: | ||
1778 | scsi_adjust_queue_depth(sdev, depth); | ||
1779 | break; | ||
1780 | case SCSI_QDEPTH_QFULL: | ||
1781 | scsi_track_queue_full(sdev, depth); | ||
1782 | break; | ||
1783 | case SCSI_QDEPTH_RAMP_UP: | ||
1784 | scsi_adjust_queue_depth(sdev, depth); | ||
1785 | break; | ||
1786 | default: | ||
1787 | return -EOPNOTSUPP; | ||
1788 | } | ||
1789 | return sdev->queue_depth; | 1777 | return sdev->queue_depth; |
1790 | } | 1778 | } |
1791 | EXPORT_SYMBOL_GPL(iscsi_change_queue_depth); | 1779 | EXPORT_SYMBOL_GPL(iscsi_change_queue_depth); |
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 89e8b687a679..914e41165137 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c | |||
@@ -961,20 +961,9 @@ int sas_change_queue_depth(struct scsi_device *sdev, int depth, int reason) | |||
961 | return __ata_change_queue_depth(dev->sata_dev.ap, sdev, depth, | 961 | return __ata_change_queue_depth(dev->sata_dev.ap, sdev, depth, |
962 | reason); | 962 | reason); |
963 | 963 | ||
964 | switch (reason) { | 964 | if (!sdev->tagged_supported) |
965 | case SCSI_QDEPTH_DEFAULT: | 965 | depth = 1; |
966 | case SCSI_QDEPTH_RAMP_UP: | 966 | scsi_adjust_queue_depth(sdev, depth); |
967 | if (!sdev->tagged_supported) | ||
968 | depth = 1; | ||
969 | scsi_adjust_queue_depth(sdev, depth); | ||
970 | break; | ||
971 | case SCSI_QDEPTH_QFULL: | ||
972 | scsi_track_queue_full(sdev, depth); | ||
973 | break; | ||
974 | default: | ||
975 | return -EOPNOTSUPP; | ||
976 | } | ||
977 | |||
978 | return depth; | 967 | return depth; |
979 | } | 968 | } |
980 | 969 | ||
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 80351fff1a07..522854920369 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -255,26 +255,7 @@ lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
255 | static int | 255 | static int |
256 | lpfc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) | 256 | lpfc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) |
257 | { | 257 | { |
258 | struct lpfc_vport *vport = (struct lpfc_vport *) sdev->host->hostdata; | 258 | scsi_adjust_queue_depth(sdev, qdepth); |
259 | |||
260 | switch (reason) { | ||
261 | case SCSI_QDEPTH_DEFAULT: | ||
262 | /* change request from sysfs, fall through */ | ||
263 | case SCSI_QDEPTH_RAMP_UP: | ||
264 | scsi_adjust_queue_depth(sdev, qdepth); | ||
265 | break; | ||
266 | case SCSI_QDEPTH_QFULL: | ||
267 | if (scsi_track_queue_full(sdev, qdepth) == 0) | ||
268 | return sdev->queue_depth; | ||
269 | |||
270 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, | ||
271 | "0711 detected queue full - lun queue " | ||
272 | "depth adjusted to %d.\n", sdev->queue_depth); | ||
273 | break; | ||
274 | default: | ||
275 | return -EOPNOTSUPP; | ||
276 | } | ||
277 | |||
278 | return sdev->queue_depth; | 259 | return sdev->queue_depth; |
279 | } | 260 | } |
280 | 261 | ||
@@ -5918,6 +5899,7 @@ struct scsi_host_template lpfc_template = { | |||
5918 | .change_queue_depth = lpfc_change_queue_depth, | 5899 | .change_queue_depth = lpfc_change_queue_depth, |
5919 | .change_queue_type = scsi_change_queue_type, | 5900 | .change_queue_type = scsi_change_queue_type, |
5920 | .use_blk_tags = 1, | 5901 | .use_blk_tags = 1, |
5902 | .track_queue_depth = 1, | ||
5921 | }; | 5903 | }; |
5922 | 5904 | ||
5923 | struct scsi_host_template lpfc_vport_template = { | 5905 | struct scsi_host_template lpfc_vport_template = { |
@@ -5942,4 +5924,5 @@ struct scsi_host_template lpfc_vport_template = { | |||
5942 | .change_queue_depth = lpfc_change_queue_depth, | 5924 | .change_queue_depth = lpfc_change_queue_depth, |
5943 | .change_queue_type = scsi_change_queue_type, | 5925 | .change_queue_type = scsi_change_queue_type, |
5944 | .use_blk_tags = 1, | 5926 | .use_blk_tags = 1, |
5927 | .track_queue_depth = 1, | ||
5945 | }; | 5928 | }; |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 42fef914d441..b006e1e9fcb8 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
@@ -1229,7 +1229,7 @@ _scsih_adjust_queue_depth(struct scsi_device *sdev, int qdepth) | |||
1229 | * _scsih_change_queue_depth - setting device queue depth | 1229 | * _scsih_change_queue_depth - setting device queue depth |
1230 | * @sdev: scsi device struct | 1230 | * @sdev: scsi device struct |
1231 | * @qdepth: requested queue depth | 1231 | * @qdepth: requested queue depth |
1232 | * @reason: SCSI_QDEPTH_DEFAULT/SCSI_QDEPTH_QFULL/SCSI_QDEPTH_RAMP_UP | 1232 | * @reason: SCSI_QDEPTH_DEFAULT |
1233 | * (see include/scsi/scsi_host.h for definition) | 1233 | * (see include/scsi/scsi_host.h for definition) |
1234 | * | 1234 | * |
1235 | * Returns queue depth. | 1235 | * Returns queue depth. |
@@ -1237,12 +1237,7 @@ _scsih_adjust_queue_depth(struct scsi_device *sdev, int qdepth) | |||
1237 | static int | 1237 | static int |
1238 | _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) | 1238 | _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) |
1239 | { | 1239 | { |
1240 | if (reason == SCSI_QDEPTH_DEFAULT || reason == SCSI_QDEPTH_RAMP_UP) | 1240 | _scsih_adjust_queue_depth(sdev, qdepth); |
1241 | _scsih_adjust_queue_depth(sdev, qdepth); | ||
1242 | else if (reason == SCSI_QDEPTH_QFULL) | ||
1243 | scsi_track_queue_full(sdev, qdepth); | ||
1244 | else | ||
1245 | return -EOPNOTSUPP; | ||
1246 | 1241 | ||
1247 | if (sdev->inquiry_len > 7) | 1242 | if (sdev->inquiry_len > 7) |
1248 | sdev_printk(KERN_INFO, sdev, "qdepth(%d), tagged(%d), " | 1243 | sdev_printk(KERN_INFO, sdev, "qdepth(%d), tagged(%d), " |
@@ -7637,6 +7632,7 @@ static struct scsi_host_template scsih_driver_template = { | |||
7637 | .use_clustering = ENABLE_CLUSTERING, | 7632 | .use_clustering = ENABLE_CLUSTERING, |
7638 | .shost_attrs = mpt2sas_host_attrs, | 7633 | .shost_attrs = mpt2sas_host_attrs, |
7639 | .sdev_attrs = mpt2sas_dev_attrs, | 7634 | .sdev_attrs = mpt2sas_dev_attrs, |
7635 | .track_queue_depth = 1, | ||
7640 | }; | 7636 | }; |
7641 | 7637 | ||
7642 | /** | 7638 | /** |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index b23c2e7588e5..568dcaed36cb 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c | |||
@@ -1097,7 +1097,7 @@ _scsih_adjust_queue_depth(struct scsi_device *sdev, int qdepth) | |||
1097 | * _scsih_change_queue_depth - setting device queue depth | 1097 | * _scsih_change_queue_depth - setting device queue depth |
1098 | * @sdev: scsi device struct | 1098 | * @sdev: scsi device struct |
1099 | * @qdepth: requested queue depth | 1099 | * @qdepth: requested queue depth |
1100 | * @reason: SCSI_QDEPTH_DEFAULT/SCSI_QDEPTH_QFULL/SCSI_QDEPTH_RAMP_UP | 1100 | * @reason: SCSI_QDEPTH_DEFAULT |
1101 | * (see include/scsi/scsi_host.h for definition) | 1101 | * (see include/scsi/scsi_host.h for definition) |
1102 | * | 1102 | * |
1103 | * Returns queue depth. | 1103 | * Returns queue depth. |
@@ -1105,12 +1105,7 @@ _scsih_adjust_queue_depth(struct scsi_device *sdev, int qdepth) | |||
1105 | static int | 1105 | static int |
1106 | _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) | 1106 | _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) |
1107 | { | 1107 | { |
1108 | if (reason == SCSI_QDEPTH_DEFAULT || reason == SCSI_QDEPTH_RAMP_UP) | 1108 | _scsih_adjust_queue_depth(sdev, qdepth); |
1109 | _scsih_adjust_queue_depth(sdev, qdepth); | ||
1110 | else if (reason == SCSI_QDEPTH_QFULL) | ||
1111 | scsi_track_queue_full(sdev, qdepth); | ||
1112 | else | ||
1113 | return -EOPNOTSUPP; | ||
1114 | 1109 | ||
1115 | if (sdev->inquiry_len > 7) | 1110 | if (sdev->inquiry_len > 7) |
1116 | sdev_printk(KERN_INFO, sdev, "qdepth(%d), tagged(%d), " \ | 1111 | sdev_printk(KERN_INFO, sdev, "qdepth(%d), tagged(%d), " \ |
@@ -7266,6 +7261,7 @@ static struct scsi_host_template scsih_driver_template = { | |||
7266 | .use_clustering = ENABLE_CLUSTERING, | 7261 | .use_clustering = ENABLE_CLUSTERING, |
7267 | .shost_attrs = mpt3sas_host_attrs, | 7262 | .shost_attrs = mpt3sas_host_attrs, |
7268 | .sdev_attrs = mpt3sas_dev_attrs, | 7263 | .sdev_attrs = mpt3sas_dev_attrs, |
7264 | .track_queue_depth = 1, | ||
7269 | }; | 7265 | }; |
7270 | 7266 | ||
7271 | /** | 7267 | /** |
diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c index d3c1fa5e76fb..ac7c03078409 100644 --- a/drivers/scsi/mvsas/mv_init.c +++ b/drivers/scsi/mvsas/mv_init.c | |||
@@ -77,6 +77,7 @@ static struct scsi_host_template mvs_sht = { | |||
77 | .ioctl = sas_ioctl, | 77 | .ioctl = sas_ioctl, |
78 | .shost_attrs = mvst_host_attrs, | 78 | .shost_attrs = mvst_host_attrs, |
79 | .use_blk_tags = 1, | 79 | .use_blk_tags = 1, |
80 | .track_queue_depth = 1, | ||
80 | }; | 81 | }; |
81 | 82 | ||
82 | static struct sas_domain_function_template mvs_transport_ops = { | 83 | static struct sas_domain_function_template mvs_transport_ops = { |
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index 3ff759a3b74d..19ae6cab5e44 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c | |||
@@ -90,6 +90,7 @@ static struct scsi_host_template pm8001_sht = { | |||
90 | .ioctl = sas_ioctl, | 90 | .ioctl = sas_ioctl, |
91 | .shost_attrs = pm8001_host_attrs, | 91 | .shost_attrs = pm8001_host_attrs, |
92 | .use_blk_tags = 1, | 92 | .use_blk_tags = 1, |
93 | .track_queue_depth = 1, | ||
93 | }; | 94 | }; |
94 | 95 | ||
95 | /** | 96 | /** |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 33166ebec7d8..20049b176b64 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -270,6 +270,7 @@ struct scsi_host_template qla2xxx_driver_template = { | |||
270 | 270 | ||
271 | .supported_mode = MODE_INITIATOR, | 271 | .supported_mode = MODE_INITIATOR, |
272 | .use_blk_tags = 1, | 272 | .use_blk_tags = 1, |
273 | .track_queue_depth = 1, | ||
273 | }; | 274 | }; |
274 | 275 | ||
275 | static struct scsi_transport_template *qla2xxx_transport_template = NULL; | 276 | static struct scsi_transport_template *qla2xxx_transport_template = NULL; |
@@ -1415,55 +1416,10 @@ qla2xxx_slave_destroy(struct scsi_device *sdev) | |||
1415 | sdev->hostdata = NULL; | 1416 | sdev->hostdata = NULL; |
1416 | } | 1417 | } |
1417 | 1418 | ||
1418 | static void qla2x00_handle_queue_full(struct scsi_device *sdev, int qdepth) | ||
1419 | { | ||
1420 | fc_port_t *fcport = (struct fc_port *) sdev->hostdata; | ||
1421 | |||
1422 | if (!scsi_track_queue_full(sdev, qdepth)) | ||
1423 | return; | ||
1424 | |||
1425 | ql_dbg(ql_dbg_io, fcport->vha, 0x3029, | ||
1426 | "Queue depth adjusted-down to %d for nexus=%ld:%d:%llu.\n", | ||
1427 | sdev->queue_depth, fcport->vha->host_no, sdev->id, sdev->lun); | ||
1428 | } | ||
1429 | |||
1430 | static void qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, int qdepth) | ||
1431 | { | ||
1432 | fc_port_t *fcport = sdev->hostdata; | ||
1433 | struct scsi_qla_host *vha = fcport->vha; | ||
1434 | struct req_que *req = NULL; | ||
1435 | |||
1436 | req = vha->req; | ||
1437 | if (!req) | ||
1438 | return; | ||
1439 | |||
1440 | if (req->max_q_depth <= sdev->queue_depth || req->max_q_depth < qdepth) | ||
1441 | return; | ||
1442 | |||
1443 | scsi_adjust_queue_depth(sdev, qdepth); | ||
1444 | |||
1445 | ql_dbg(ql_dbg_io, vha, 0x302a, | ||
1446 | "Queue depth adjusted-up to %d for nexus=%ld:%d:%llu.\n", | ||
1447 | sdev->queue_depth, fcport->vha->host_no, sdev->id, sdev->lun); | ||
1448 | } | ||
1449 | |||
1450 | static int | 1419 | static int |
1451 | qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) | 1420 | qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) |
1452 | { | 1421 | { |
1453 | switch (reason) { | 1422 | scsi_adjust_queue_depth(sdev, qdepth); |
1454 | case SCSI_QDEPTH_DEFAULT: | ||
1455 | scsi_adjust_queue_depth(sdev, qdepth); | ||
1456 | break; | ||
1457 | case SCSI_QDEPTH_QFULL: | ||
1458 | qla2x00_handle_queue_full(sdev, qdepth); | ||
1459 | break; | ||
1460 | case SCSI_QDEPTH_RAMP_UP: | ||
1461 | qla2x00_adjust_sdev_qdepth_up(sdev, qdepth); | ||
1462 | break; | ||
1463 | default: | ||
1464 | return -EOPNOTSUPP; | ||
1465 | } | ||
1466 | |||
1467 | return sdev->queue_depth; | 1423 | return sdev->queue_depth; |
1468 | } | 1424 | } |
1469 | 1425 | ||
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index f8724f2e0158..2bfde373ea2b 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -164,8 +164,6 @@ static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd); | |||
164 | static int qla4xxx_slave_alloc(struct scsi_device *device); | 164 | static int qla4xxx_slave_alloc(struct scsi_device *device); |
165 | static umode_t qla4_attr_is_visible(int param_type, int param); | 165 | static umode_t qla4_attr_is_visible(int param_type, int param); |
166 | static int qla4xxx_host_reset(struct Scsi_Host *shost, int reset_type); | 166 | static int qla4xxx_host_reset(struct Scsi_Host *shost, int reset_type); |
167 | static int qla4xxx_change_queue_depth(struct scsi_device *sdev, int qdepth, | ||
168 | int reason); | ||
169 | 167 | ||
170 | /* | 168 | /* |
171 | * iSCSI Flash DDB sysfs entry points | 169 | * iSCSI Flash DDB sysfs entry points |
@@ -203,7 +201,7 @@ static struct scsi_host_template qla4xxx_driver_template = { | |||
203 | .eh_timed_out = qla4xxx_eh_cmd_timed_out, | 201 | .eh_timed_out = qla4xxx_eh_cmd_timed_out, |
204 | 202 | ||
205 | .slave_alloc = qla4xxx_slave_alloc, | 203 | .slave_alloc = qla4xxx_slave_alloc, |
206 | .change_queue_depth = qla4xxx_change_queue_depth, | 204 | .change_queue_depth = iscsi_change_queue_depth, |
207 | 205 | ||
208 | .this_id = -1, | 206 | .this_id = -1, |
209 | .cmd_per_lun = 3, | 207 | .cmd_per_lun = 3, |
@@ -9065,15 +9063,6 @@ static int qla4xxx_slave_alloc(struct scsi_device *sdev) | |||
9065 | return 0; | 9063 | return 0; |
9066 | } | 9064 | } |
9067 | 9065 | ||
9068 | static int qla4xxx_change_queue_depth(struct scsi_device *sdev, int qdepth, | ||
9069 | int reason) | ||
9070 | { | ||
9071 | if (!ql4xqfulltracking) | ||
9072 | return -EOPNOTSUPP; | ||
9073 | |||
9074 | return iscsi_change_queue_depth(sdev, qdepth, reason); | ||
9075 | } | ||
9076 | |||
9077 | /** | 9066 | /** |
9078 | * qla4xxx_del_from_active_array - returns an active srb | 9067 | * qla4xxx_del_from_active_array - returns an active srb |
9079 | * @ha: Pointer to host adapter structure. | 9068 | * @ha: Pointer to host adapter structure. |
@@ -9873,6 +9862,9 @@ static int __init qla4xxx_module_init(void) | |||
9873 | { | 9862 | { |
9874 | int ret; | 9863 | int ret; |
9875 | 9864 | ||
9865 | if (ql4xqfulltracking) | ||
9866 | qla4xxx_driver_template.track_queue_depth = 1; | ||
9867 | |||
9876 | /* Allocate cache for SRBs. */ | 9868 | /* Allocate cache for SRBs. */ |
9877 | srb_cachep = kmem_cache_create("qla4xxx_srbs", sizeof(struct srb), 0, | 9869 | srb_cachep = kmem_cache_create("qla4xxx_srbs", sizeof(struct srb), 0, |
9878 | SLAB_HWCACHE_ALIGN, NULL); | 9870 | SLAB_HWCACHE_ALIGN, NULL); |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index fce393f3e7e0..84cf82e0782d 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -4472,7 +4472,6 @@ static int | |||
4472 | sdebug_change_qdepth(struct scsi_device *sdev, int qdepth, int reason) | 4472 | sdebug_change_qdepth(struct scsi_device *sdev, int qdepth, int reason) |
4473 | { | 4473 | { |
4474 | int num_in_q = 0; | 4474 | int num_in_q = 0; |
4475 | int bad = 0; | ||
4476 | unsigned long iflags; | 4475 | unsigned long iflags; |
4477 | struct sdebug_dev_info *devip; | 4476 | struct sdebug_dev_info *devip; |
4478 | 4477 | ||
@@ -4484,43 +4483,18 @@ sdebug_change_qdepth(struct scsi_device *sdev, int qdepth, int reason) | |||
4484 | } | 4483 | } |
4485 | num_in_q = atomic_read(&devip->num_in_q); | 4484 | num_in_q = atomic_read(&devip->num_in_q); |
4486 | spin_unlock_irqrestore(&queued_arr_lock, iflags); | 4485 | spin_unlock_irqrestore(&queued_arr_lock, iflags); |
4487 | if (reason == SCSI_QDEPTH_DEFAULT || reason == SCSI_QDEPTH_RAMP_UP) { | 4486 | |
4488 | if (qdepth < 1) | 4487 | if (qdepth < 1) |
4489 | qdepth = 1; | 4488 | qdepth = 1; |
4490 | /* allow to exceed max host queued_arr elements for testing */ | 4489 | /* allow to exceed max host queued_arr elements for testing */ |
4491 | if (qdepth > SCSI_DEBUG_CANQUEUE + 10) | 4490 | if (qdepth > SCSI_DEBUG_CANQUEUE + 10) |
4492 | qdepth = SCSI_DEBUG_CANQUEUE + 10; | 4491 | qdepth = SCSI_DEBUG_CANQUEUE + 10; |
4493 | scsi_adjust_queue_depth(sdev, qdepth); | 4492 | scsi_adjust_queue_depth(sdev, qdepth); |
4494 | } else if (reason == SCSI_QDEPTH_QFULL) | 4493 | |
4495 | scsi_track_queue_full(sdev, qdepth); | ||
4496 | else | ||
4497 | bad = 1; | ||
4498 | if (bad) | ||
4499 | sdev_printk(KERN_WARNING, sdev, | ||
4500 | "%s: unknown reason=0x%x\n", __func__, reason); | ||
4501 | if (SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts) { | 4494 | if (SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts) { |
4502 | if (SCSI_QDEPTH_QFULL == reason) | 4495 | sdev_printk(KERN_INFO, sdev, |
4503 | sdev_printk(KERN_INFO, sdev, | 4496 | "%s: qdepth=%d, num_in_q=%d\n", |
4504 | "%s: -> %d, num_in_q=%d, reason: queue full\n", | 4497 | __func__, qdepth, num_in_q); |
4505 | __func__, qdepth, num_in_q); | ||
4506 | else { | ||
4507 | const char *cp; | ||
4508 | |||
4509 | switch (reason) { | ||
4510 | case SCSI_QDEPTH_DEFAULT: | ||
4511 | cp = "default (sysfs ?)"; | ||
4512 | break; | ||
4513 | case SCSI_QDEPTH_RAMP_UP: | ||
4514 | cp = "ramp up"; | ||
4515 | break; | ||
4516 | default: | ||
4517 | cp = "unknown"; | ||
4518 | break; | ||
4519 | } | ||
4520 | sdev_printk(KERN_INFO, sdev, | ||
4521 | "%s: qdepth=%d, num_in_q=%d, reason: %s\n", | ||
4522 | __func__, qdepth, num_in_q, cp); | ||
4523 | } | ||
4524 | } | 4498 | } |
4525 | return sdev->queue_depth; | 4499 | return sdev->queue_depth; |
4526 | } | 4500 | } |
@@ -4576,6 +4550,7 @@ static struct scsi_host_template sdebug_driver_template = { | |||
4576 | .max_sectors = -1U, | 4550 | .max_sectors = -1U, |
4577 | .use_clustering = DISABLE_CLUSTERING, | 4551 | .use_clustering = DISABLE_CLUSTERING, |
4578 | .module = THIS_MODULE, | 4552 | .module = THIS_MODULE, |
4553 | .track_queue_depth = 1, | ||
4579 | }; | 4554 | }; |
4580 | 4555 | ||
4581 | static int sdebug_driver_probe(struct device * dev) | 4556 | static int sdebug_driver_probe(struct device * dev) |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index a6f6b9222b51..2d0f5155ee51 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -610,7 +610,7 @@ static void scsi_handle_queue_ramp_up(struct scsi_device *sdev) | |||
610 | struct scsi_host_template *sht = sdev->host->hostt; | 610 | struct scsi_host_template *sht = sdev->host->hostt; |
611 | struct scsi_device *tmp_sdev; | 611 | struct scsi_device *tmp_sdev; |
612 | 612 | ||
613 | if (!sht->change_queue_depth || | 613 | if (!sht->track_queue_depth || |
614 | sdev->queue_depth >= sdev->max_queue_depth) | 614 | sdev->queue_depth >= sdev->max_queue_depth) |
615 | return; | 615 | return; |
616 | 616 | ||
@@ -631,12 +631,8 @@ static void scsi_handle_queue_ramp_up(struct scsi_device *sdev) | |||
631 | tmp_sdev->id != sdev->id || | 631 | tmp_sdev->id != sdev->id || |
632 | tmp_sdev->queue_depth == sdev->max_queue_depth) | 632 | tmp_sdev->queue_depth == sdev->max_queue_depth) |
633 | continue; | 633 | continue; |
634 | /* | 634 | |
635 | * call back into LLD to increase queue_depth by one | 635 | scsi_adjust_queue_depth(tmp_sdev, tmp_sdev->queue_depth + 1); |
636 | * with ramp up reason code. | ||
637 | */ | ||
638 | sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth + 1, | ||
639 | SCSI_QDEPTH_RAMP_UP); | ||
640 | sdev->last_queue_ramp_up = jiffies; | 636 | sdev->last_queue_ramp_up = jiffies; |
641 | } | 637 | } |
642 | } | 638 | } |
@@ -646,7 +642,7 @@ static void scsi_handle_queue_full(struct scsi_device *sdev) | |||
646 | struct scsi_host_template *sht = sdev->host->hostt; | 642 | struct scsi_host_template *sht = sdev->host->hostt; |
647 | struct scsi_device *tmp_sdev; | 643 | struct scsi_device *tmp_sdev; |
648 | 644 | ||
649 | if (!sht->change_queue_depth) | 645 | if (!sht->track_queue_depth) |
650 | return; | 646 | return; |
651 | 647 | ||
652 | shost_for_each_device(tmp_sdev, sdev->host) { | 648 | shost_for_each_device(tmp_sdev, sdev->host) { |
@@ -658,8 +654,7 @@ static void scsi_handle_queue_full(struct scsi_device *sdev) | |||
658 | * the device when we got the queue full so we start | 654 | * the device when we got the queue full so we start |
659 | * from the highest possible value and work our way down. | 655 | * from the highest possible value and work our way down. |
660 | */ | 656 | */ |
661 | sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth - 1, | 657 | scsi_track_queue_full(tmp_sdev, tmp_sdev->queue_depth - 1); |
662 | SCSI_QDEPTH_QFULL); | ||
663 | } | 658 | } |
664 | } | 659 | } |
665 | 660 | ||
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 362b818ad827..e96ab253e3e5 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c | |||
@@ -2800,18 +2800,7 @@ static int ufshcd_change_queue_depth(struct scsi_device *sdev, | |||
2800 | if (depth > hba->nutrs) | 2800 | if (depth > hba->nutrs) |
2801 | depth = hba->nutrs; | 2801 | depth = hba->nutrs; |
2802 | 2802 | ||
2803 | switch (reason) { | 2803 | scsi_adjust_queue_depth(sdev, depth); |
2804 | case SCSI_QDEPTH_DEFAULT: | ||
2805 | case SCSI_QDEPTH_RAMP_UP: | ||
2806 | scsi_adjust_queue_depth(sdev, depth); | ||
2807 | break; | ||
2808 | case SCSI_QDEPTH_QFULL: | ||
2809 | scsi_track_queue_full(sdev, depth); | ||
2810 | break; | ||
2811 | default: | ||
2812 | return -EOPNOTSUPP; | ||
2813 | } | ||
2814 | |||
2815 | return depth; | 2804 | return depth; |
2816 | } | 2805 | } |
2817 | 2806 | ||
@@ -4231,6 +4220,7 @@ static struct scsi_host_template ufshcd_driver_template = { | |||
4231 | .can_queue = UFSHCD_CAN_QUEUE, | 4220 | .can_queue = UFSHCD_CAN_QUEUE, |
4232 | .max_host_blocked = 1, | 4221 | .max_host_blocked = 1, |
4233 | .use_blk_tags = 1, | 4222 | .use_blk_tags = 1, |
4223 | .track_queue_depth = 1, | ||
4234 | }; | 4224 | }; |
4235 | 4225 | ||
4236 | static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, | 4226 | static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, |
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 8e40347da0a8..0f7e4c7ff8c2 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -691,18 +691,7 @@ static int virtscsi_change_queue_depth(struct scsi_device *sdev, | |||
691 | struct Scsi_Host *shost = sdev->host; | 691 | struct Scsi_Host *shost = sdev->host; |
692 | int max_depth = shost->cmd_per_lun; | 692 | int max_depth = shost->cmd_per_lun; |
693 | 693 | ||
694 | switch (reason) { | 694 | scsi_adjust_queue_depth(sdev, min(max_depth, qdepth)); |
695 | case SCSI_QDEPTH_QFULL: /* Drop qdepth in response to BUSY state */ | ||
696 | scsi_track_queue_full(sdev, qdepth); | ||
697 | break; | ||
698 | case SCSI_QDEPTH_RAMP_UP: /* Raise qdepth after BUSY state resolved */ | ||
699 | case SCSI_QDEPTH_DEFAULT: /* Manual change via sysfs */ | ||
700 | scsi_adjust_queue_depth(sdev, min(max_depth, qdepth)); | ||
701 | break; | ||
702 | default: | ||
703 | return -EOPNOTSUPP; | ||
704 | } | ||
705 | |||
706 | return sdev->queue_depth; | 695 | return sdev->queue_depth; |
707 | } | 696 | } |
708 | 697 | ||
@@ -770,6 +759,7 @@ static struct scsi_host_template virtscsi_host_template_single = { | |||
770 | .use_clustering = ENABLE_CLUSTERING, | 759 | .use_clustering = ENABLE_CLUSTERING, |
771 | .target_alloc = virtscsi_target_alloc, | 760 | .target_alloc = virtscsi_target_alloc, |
772 | .target_destroy = virtscsi_target_destroy, | 761 | .target_destroy = virtscsi_target_destroy, |
762 | .track_queue_depth = 1, | ||
773 | }; | 763 | }; |
774 | 764 | ||
775 | static struct scsi_host_template virtscsi_host_template_multi = { | 765 | static struct scsi_host_template virtscsi_host_template_multi = { |
@@ -788,6 +778,7 @@ static struct scsi_host_template virtscsi_host_template_multi = { | |||
788 | .use_clustering = ENABLE_CLUSTERING, | 778 | .use_clustering = ENABLE_CLUSTERING, |
789 | .target_alloc = virtscsi_target_alloc, | 779 | .target_alloc = virtscsi_target_alloc, |
790 | .target_destroy = virtscsi_target_destroy, | 780 | .target_destroy = virtscsi_target_destroy, |
781 | .track_queue_depth = 1, | ||
791 | }; | 782 | }; |
792 | 783 | ||
793 | #define virtscsi_config_get(vdev, fld) \ | 784 | #define virtscsi_config_get(vdev, fld) \ |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 0ed96644ec94..670b75a62243 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -119,19 +119,7 @@ static int tcm_loop_change_queue_depth( | |||
119 | int depth, | 119 | int depth, |
120 | int reason) | 120 | int reason) |
121 | { | 121 | { |
122 | switch (reason) { | 122 | scsi_adjust_queue_depth(sdev, depth); |
123 | case SCSI_QDEPTH_DEFAULT: | ||
124 | scsi_adjust_queue_depth(sdev, depth); | ||
125 | break; | ||
126 | case SCSI_QDEPTH_QFULL: | ||
127 | scsi_track_queue_full(sdev, depth); | ||
128 | break; | ||
129 | case SCSI_QDEPTH_RAMP_UP: | ||
130 | scsi_adjust_queue_depth(sdev, depth); | ||
131 | break; | ||
132 | default: | ||
133 | return -EOPNOTSUPP; | ||
134 | } | ||
135 | return sdev->queue_depth; | 123 | return sdev->queue_depth; |
136 | } | 124 | } |
137 | 125 | ||
@@ -423,6 +411,7 @@ static struct scsi_host_template tcm_loop_driver_template = { | |||
423 | .slave_alloc = tcm_loop_slave_alloc, | 411 | .slave_alloc = tcm_loop_slave_alloc, |
424 | .module = THIS_MODULE, | 412 | .module = THIS_MODULE, |
425 | .use_blk_tags = 1, | 413 | .use_blk_tags = 1, |
414 | .track_queue_depth = 1, | ||
426 | }; | 415 | }; |
427 | 416 | ||
428 | static int tcm_loop_driver_probe(struct device *dev) | 417 | static int tcm_loop_driver_probe(struct device *dev) |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 61a81bf77e28..a0b13a5cd25e 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -48,8 +48,6 @@ struct blk_queue_tags; | |||
48 | 48 | ||
49 | enum { | 49 | enum { |
50 | SCSI_QDEPTH_DEFAULT, /* default requested change, e.g. from sysfs */ | 50 | SCSI_QDEPTH_DEFAULT, /* default requested change, e.g. from sysfs */ |
51 | SCSI_QDEPTH_QFULL, /* scsi-ml requested due to queue full */ | ||
52 | SCSI_QDEPTH_RAMP_UP, /* scsi-ml requested due to threshold event */ | ||
53 | }; | 51 | }; |
54 | 52 | ||
55 | struct scsi_host_template { | 53 | struct scsi_host_template { |
@@ -427,6 +425,11 @@ struct scsi_host_template { | |||
427 | unsigned use_blk_tags:1; | 425 | unsigned use_blk_tags:1; |
428 | 426 | ||
429 | /* | 427 | /* |
428 | * Track QUEUE_FULL events and reduce queue depth on demand. | ||
429 | */ | ||
430 | unsigned track_queue_depth:1; | ||
431 | |||
432 | /* | ||
430 | * This specifies the mode that a LLD supports. | 433 | * This specifies the mode that a LLD supports. |
431 | */ | 434 | */ |
432 | unsigned supported_mode:2; | 435 | unsigned supported_mode:2; |