aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-11-03 14:15:14 -0500
committerChristoph Hellwig <hch@lst.de>2014-11-12 05:19:43 -0500
commitc8b09f6fb67df7fc1b51ced1037fa9b677428149 (patch)
tree87527c3e17a7539c0ffa9f64fbd85ec2ad3dabf1 /drivers
parent2ecb204d07ac8debe3893c362415919bc78bebd6 (diff)
scsi: don't set tagging state from scsi_adjust_queue_depth
Remove the tagged argument from scsi_adjust_queue_depth, and just let it handle the queue depth. For most drivers those two are fairly separate, given that most modern drivers don't care about the SCSI "tagged" status of a command at all, and many old drivers allow queuing of multiple untagged commands in the driver. Instead we start out with the ->simple_tags flag set before calling ->slave_configure, which is how all drivers actually looking at ->simple_tags except for one worke anyway. The one other case looks broken, but I've kept the behavior as-is for now. Except for that we only change ->simple_tags from the ->change_queue_type, and when rejecting a tag message in a single driver, so keeping this churn out of scsi_adjust_queue_depth is a clear win. Now that the usage of scsi_adjust_queue_depth is more obvious we can also remove all the trivial instances in ->slave_alloc or ->slave_configure that just set it to the cmd_per_lun default. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-scsi.c4
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c2
-rw-r--r--drivers/message/fusion/mptscsih.c2
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c8
-rw-r--r--drivers/scsi/3w-9xxx.c2
-rw-r--r--drivers/scsi/3w-sas.c2
-rw-r--r--drivers/scsi/3w-xxxx.c2
-rw-r--r--drivers/scsi/53c700.c17
-rw-r--r--drivers/scsi/BusLogic.c4
-rw-r--r--drivers/scsi/aacraid/linit.c8
-rw-r--r--drivers/scsi/advansys.c7
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c7
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c8
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c2
-rw-r--r--drivers/scsi/bfa/bfad_im.c3
-rw-r--r--drivers/scsi/csiostor/csio_scsi.c2
-rw-r--r--drivers/scsi/dpt_i2o.c4
-rw-r--r--drivers/scsi/eata.c8
-rw-r--r--drivers/scsi/esas2r/esas2r.h3
-rw-r--r--drivers/scsi/esas2r/esas2r_main.c29
-rw-r--r--drivers/scsi/esp_scsi.c17
-rw-r--r--drivers/scsi/fnic/fnic_main.c2
-rw-r--r--drivers/scsi/gdth.c1
-rw-r--r--drivers/scsi/hpsa.c2
-rw-r--r--drivers/scsi/hptiop.c2
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c8
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c3
-rw-r--r--drivers/scsi/ipr.c8
-rw-r--r--drivers/scsi/ips.c2
-rw-r--r--drivers/scsi/libfc/fc_fcp.c6
-rw-r--r--drivers/scsi/libiscsi.c4
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c20
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c4
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c2
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c3
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c2
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_scsih.c2
-rw-r--r--drivers/scsi/ncr53c8xx.c5
-rw-r--r--drivers/scsi/pmcraid.c40
-rw-r--r--drivers/scsi/qla1280.c5
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c6
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c2
-rw-r--r--drivers/scsi/scsi.c25
-rw-r--r--drivers/scsi/scsi_debug.c7
-rw-r--r--drivers/scsi/scsi_scan.c6
-rw-r--r--drivers/scsi/stex.c2
-rw-r--r--drivers/scsi/storvsc_drv.c3
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c4
-rw-r--r--drivers/scsi/tmscsim.c9
-rw-r--r--drivers/scsi/u14-34f.c10
-rw-r--r--drivers/scsi/ufs/ufshcd.c4
-rw-r--r--drivers/scsi/virtio_scsi.c4
-rw-r--r--drivers/scsi/vmw_pvscsi.c2
-rw-r--r--drivers/target/loopback/tcm_loop.c18
-rw-r--r--drivers/usb/storage/uas.c2
55 files changed, 115 insertions, 251 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 0586f66d70fa..c8bb6abbf12c 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1164,7 +1164,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
1164 1164
1165 depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); 1165 depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id));
1166 depth = min(ATA_MAX_QUEUE - 1, depth); 1166 depth = min(ATA_MAX_QUEUE - 1, depth);
1167 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); 1167 scsi_adjust_queue_depth(sdev, depth);
1168 } 1168 }
1169 1169
1170 blk_queue_flush_queueable(q, false); 1170 blk_queue_flush_queueable(q, false);
@@ -1282,7 +1282,7 @@ int __ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev,
1282 if (sdev->queue_depth == queue_depth) 1282 if (sdev->queue_depth == queue_depth)
1283 return -EINVAL; 1283 return -EINVAL;
1284 1284
1285 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, queue_depth); 1285 scsi_adjust_queue_depth(sdev, queue_depth);
1286 return queue_depth; 1286 return queue_depth;
1287} 1287}
1288 1288
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 51670d75ab78..023a66f5ca14 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2278,7 +2278,7 @@ srp_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
2278 max_depth = 1; 2278 max_depth = 1;
2279 if (qdepth > max_depth) 2279 if (qdepth > max_depth)
2280 qdepth = max_depth; 2280 qdepth = max_depth;
2281 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 2281 scsi_adjust_queue_depth(sdev, qdepth);
2282 } else if (reason == SCSI_QDEPTH_QFULL) 2282 } else if (reason == SCSI_QDEPTH_QFULL)
2283 scsi_track_queue_full(sdev, qdepth); 2283 scsi_track_queue_full(sdev, qdepth);
2284 else 2284 else
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index c0d84a09db9a..dee06d6f0b68 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2347,7 +2347,7 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
2347 if (qdepth > max_depth) 2347 if (qdepth > max_depth)
2348 qdepth = max_depth; 2348 qdepth = max_depth;
2349 2349
2350 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 2350 scsi_adjust_queue_depth(sdev, qdepth);
2351 return sdev->queue_depth; 2351 return sdev->queue_depth;
2352} 2352}
2353 2353
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 7b353647cb90..b5dfa51f396f 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -37,13 +37,13 @@ static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth,
37{ 37{
38 switch (reason) { 38 switch (reason) {
39 case SCSI_QDEPTH_DEFAULT: 39 case SCSI_QDEPTH_DEFAULT:
40 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); 40 scsi_adjust_queue_depth(sdev, depth);
41 break; 41 break;
42 case SCSI_QDEPTH_QFULL: 42 case SCSI_QDEPTH_QFULL:
43 scsi_track_queue_full(sdev, depth); 43 scsi_track_queue_full(sdev, depth);
44 break; 44 break;
45 case SCSI_QDEPTH_RAMP_UP: 45 case SCSI_QDEPTH_RAMP_UP:
46 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); 46 scsi_adjust_queue_depth(sdev, depth);
47 break; 47 break;
48 default: 48 default:
49 return -EOPNOTSUPP; 49 return -EOPNOTSUPP;
@@ -66,9 +66,7 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdev)
66static int zfcp_scsi_slave_configure(struct scsi_device *sdp) 66static int zfcp_scsi_slave_configure(struct scsi_device *sdp)
67{ 67{
68 if (sdp->tagged_supported) 68 if (sdp->tagged_supported)
69 scsi_adjust_queue_depth(sdp, MSG_SIMPLE_TAG, default_depth); 69 scsi_adjust_queue_depth(sdp, default_depth);
70 else
71 scsi_adjust_queue_depth(sdp, 0, 1);
72 return 0; 70 return 0;
73} 71}
74 72
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 0a7325361d29..02021f5ca866 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -198,7 +198,7 @@ static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth,
198 198
199 if (queue_depth > TW_Q_LENGTH-2) 199 if (queue_depth > TW_Q_LENGTH-2)
200 queue_depth = TW_Q_LENGTH-2; 200 queue_depth = TW_Q_LENGTH-2;
201 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); 201 scsi_adjust_queue_depth(sdev, queue_depth);
202 return queue_depth; 202 return queue_depth;
203} /* End twa_change_queue_depth() */ 203} /* End twa_change_queue_depth() */
204 204
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index 6da6cec9a651..ac0c2544a470 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -200,7 +200,7 @@ static int twl_change_queue_depth(struct scsi_device *sdev, int queue_depth,
200 200
201 if (queue_depth > TW_Q_LENGTH-2) 201 if (queue_depth > TW_Q_LENGTH-2)
202 queue_depth = TW_Q_LENGTH-2; 202 queue_depth = TW_Q_LENGTH-2;
203 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); 203 scsi_adjust_queue_depth(sdev, queue_depth);
204 return queue_depth; 204 return queue_depth;
205} /* End twl_change_queue_depth() */ 205} /* End twl_change_queue_depth() */
206 206
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 752624e6bc00..1ec9ad92b6c3 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -532,7 +532,7 @@ static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth,
532 532
533 if (queue_depth > TW_Q_LENGTH-2) 533 if (queue_depth > TW_Q_LENGTH-2)
534 queue_depth = TW_Q_LENGTH-2; 534 queue_depth = TW_Q_LENGTH-2;
535 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); 535 scsi_adjust_queue_depth(sdev, queue_depth);
536 return queue_depth; 536 return queue_depth;
537} /* End tw_change_queue_depth() */ 537} /* End tw_change_queue_depth() */
538 538
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 497cbb1efd4b..d7557b932113 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -902,8 +902,10 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
902 /* we're done negotiating */ 902 /* we're done negotiating */
903 NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION); 903 NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION);
904 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); 904 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp));
905
905 SCp->device->tagged_supported = 0; 906 SCp->device->tagged_supported = 0;
906 scsi_adjust_queue_depth(SCp->device, 0, host->cmd_per_lun); 907 scsi_adjust_queue_depth(SCp->device, host->cmd_per_lun);
908 scsi_set_tag_type(SCp->device, 0);
907 } else { 909 } else {
908 shost_printk(KERN_WARNING, host, 910 shost_printk(KERN_WARNING, host,
909 "(%d:%d) Unexpected REJECT Message %s\n", 911 "(%d:%d) Unexpected REJECT Message %s\n",
@@ -2050,12 +2052,10 @@ NCR_700_slave_configure(struct scsi_device *SDp)
2050 2052
2051 /* to do here: allocate memory; build a queue_full list */ 2053 /* to do here: allocate memory; build a queue_full list */
2052 if(SDp->tagged_supported) { 2054 if(SDp->tagged_supported) {
2053 scsi_adjust_queue_depth(SDp, MSG_ORDERED_TAG, NCR_700_DEFAULT_TAGS); 2055 scsi_adjust_queue_depth(SDp, NCR_700_DEFAULT_TAGS);
2054 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION); 2056 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION);
2055 } else {
2056 /* initialise to default depth */
2057 scsi_adjust_queue_depth(SDp, 0, SDp->host->cmd_per_lun);
2058 } 2057 }
2058
2059 if(hostdata->fast) { 2059 if(hostdata->fast) {
2060 /* Find the correct offset and period via domain validation */ 2060 /* Find the correct offset and period via domain validation */
2061 if (!spi_initial_dv(SDp->sdev_target)) 2061 if (!spi_initial_dv(SDp->sdev_target))
@@ -2083,7 +2083,7 @@ NCR_700_change_queue_depth(struct scsi_device *SDp, int depth, int reason)
2083 if (depth > NCR_700_MAX_TAGS) 2083 if (depth > NCR_700_MAX_TAGS)
2084 depth = NCR_700_MAX_TAGS; 2084 depth = NCR_700_MAX_TAGS;
2085 2085
2086 scsi_adjust_queue_depth(SDp, scsi_get_tag_type(SDp), depth); 2086 scsi_adjust_queue_depth(SDp, depth);
2087 return depth; 2087 return depth;
2088} 2088}
2089 2089
@@ -2101,15 +2101,16 @@ static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type)
2101 if (change_tag) 2101 if (change_tag)
2102 scsi_target_quiesce(SDp->sdev_target); 2102 scsi_target_quiesce(SDp->sdev_target);
2103 2103
2104 scsi_set_tag_type(SDp, tag_type);
2104 if (!tag_type) { 2105 if (!tag_type) {
2105 /* shift back to the default unqueued number of commands 2106 /* shift back to the default unqueued number of commands
2106 * (the user can still raise this) */ 2107 * (the user can still raise this) */
2107 scsi_adjust_queue_depth(SDp, 0, SDp->host->cmd_per_lun); 2108 scsi_adjust_queue_depth(SDp, SDp->host->cmd_per_lun);
2108 hostdata->tag_negotiated &= ~(1 << sdev_id(SDp)); 2109 hostdata->tag_negotiated &= ~(1 << sdev_id(SDp));
2109 } else { 2110 } else {
2110 /* Here, we cleared the negotiation flag above, so this 2111 /* Here, we cleared the negotiation flag above, so this
2111 * will force the driver to renegotiate */ 2112 * will force the driver to renegotiate */
2112 scsi_adjust_queue_depth(SDp, tag_type, SDp->queue_depth); 2113 scsi_adjust_queue_depth(SDp, SDp->queue_depth);
2113 if (change_tag) 2114 if (change_tag)
2114 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION); 2115 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION);
2115 } 2116 }
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 64c75143c89a..5aa476b6b8a8 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -2327,12 +2327,12 @@ static int blogic_slaveconfig(struct scsi_device *dev)
2327 if (qdepth == 0) 2327 if (qdepth == 0)
2328 qdepth = BLOGIC_MAX_AUTO_TAG_DEPTH; 2328 qdepth = BLOGIC_MAX_AUTO_TAG_DEPTH;
2329 adapter->qdepth[tgt_id] = qdepth; 2329 adapter->qdepth[tgt_id] = qdepth;
2330 scsi_adjust_queue_depth(dev, MSG_SIMPLE_TAG, qdepth); 2330 scsi_adjust_queue_depth(dev, qdepth);
2331 } else { 2331 } else {
2332 adapter->tagq_ok &= ~(1 << tgt_id); 2332 adapter->tagq_ok &= ~(1 << tgt_id);
2333 qdepth = adapter->untag_qdepth; 2333 qdepth = adapter->untag_qdepth;
2334 adapter->qdepth[tgt_id] = qdepth; 2334 adapter->qdepth[tgt_id] = qdepth;
2335 scsi_adjust_queue_depth(dev, 0, qdepth); 2335 scsi_adjust_queue_depth(dev, qdepth);
2336 } 2336 }
2337 qdepth = 0; 2337 qdepth = 0;
2338 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) 2338 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index a759cb2d4b15..41b9c68bca67 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -462,9 +462,9 @@ static int aac_slave_configure(struct scsi_device *sdev)
462 depth = 256; 462 depth = 256;
463 else if (depth < 2) 463 else if (depth < 2)
464 depth = 2; 464 depth = 2;
465 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth); 465 scsi_adjust_queue_depth(sdev, depth);
466 } else 466 } else
467 scsi_adjust_queue_depth(sdev, 0, 1); 467 scsi_adjust_queue_depth(sdev, 1);
468 468
469 return 0; 469 return 0;
470} 470}
@@ -504,9 +504,9 @@ static int aac_change_queue_depth(struct scsi_device *sdev, int depth,
504 depth = 256; 504 depth = 256;
505 else if (depth < 2) 505 else if (depth < 2)
506 depth = 2; 506 depth = 2;
507 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth); 507 scsi_adjust_queue_depth(sdev, depth);
508 } else 508 } else
509 scsi_adjust_queue_depth(sdev, 0, 1); 509 scsi_adjust_queue_depth(sdev, 1);
510 return sdev->queue_depth; 510 return sdev->queue_depth;
511} 511}
512 512
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 43761c1c46f0..ae4840e4c1c5 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -7706,7 +7706,7 @@ advansys_narrow_slave_configure(struct scsi_device *sdev, ASC_DVC_VAR *asc_dvc)
7706 asc_dvc->cfg->can_tagged_qng |= tid_bit; 7706 asc_dvc->cfg->can_tagged_qng |= tid_bit;
7707 asc_dvc->use_tagged_qng |= tid_bit; 7707 asc_dvc->use_tagged_qng |= tid_bit;
7708 } 7708 }
7709 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, 7709 scsi_adjust_queue_depth(sdev,
7710 asc_dvc->max_dvc_qng[sdev->id]); 7710 asc_dvc->max_dvc_qng[sdev->id]);
7711 } 7711 }
7712 } else { 7712 } else {
@@ -7714,7 +7714,6 @@ advansys_narrow_slave_configure(struct scsi_device *sdev, ASC_DVC_VAR *asc_dvc)
7714 asc_dvc->cfg->can_tagged_qng &= ~tid_bit; 7714 asc_dvc->cfg->can_tagged_qng &= ~tid_bit;
7715 asc_dvc->use_tagged_qng &= ~tid_bit; 7715 asc_dvc->use_tagged_qng &= ~tid_bit;
7716 } 7716 }
7717 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
7718 } 7717 }
7719 7718
7720 if ((sdev->lun == 0) && 7719 if ((sdev->lun == 0) &&
@@ -7849,10 +7848,8 @@ advansys_wide_slave_configure(struct scsi_device *sdev, ADV_DVC_VAR *adv_dvc)
7849 } 7848 }
7850 7849
7851 if ((adv_dvc->tagqng_able & tidmask) && sdev->tagged_supported) { 7850 if ((adv_dvc->tagqng_able & tidmask) && sdev->tagged_supported) {
7852 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, 7851 scsi_adjust_queue_depth(sdev,
7853 adv_dvc->max_dvc_qng); 7852 adv_dvc->max_dvc_qng);
7854 } else {
7855 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
7856 } 7853 }
7857} 7854}
7858 7855
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 9fd6b5618b25..80cb4fd7caaa 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1469,11 +1469,8 @@ ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
1469 1469
1470 switch ((dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED))) { 1470 switch ((dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED))) {
1471 case AHD_DEV_Q_BASIC: 1471 case AHD_DEV_Q_BASIC:
1472 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TASK,
1473 dev->openings + dev->active);
1474 break;
1475 case AHD_DEV_Q_TAGGED: 1472 case AHD_DEV_Q_TAGGED:
1476 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TASK, 1473 scsi_adjust_queue_depth(sdev,
1477 dev->openings + dev->active); 1474 dev->openings + dev->active);
1478 break; 1475 break;
1479 default: 1476 default:
@@ -1483,7 +1480,7 @@ ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
1483 * serially on the controller/device. This should 1480 * serially on the controller/device. This should
1484 * remove some latency. 1481 * remove some latency.
1485 */ 1482 */
1486 scsi_adjust_queue_depth(sdev, 0, 1); 1483 scsi_adjust_queue_depth(sdev, 1);
1487 break; 1484 break;
1488 } 1485 }
1489} 1486}
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index f18b6d69d3fb..a6a27d5398dd 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1335,13 +1335,9 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
1335 } 1335 }
1336 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { 1336 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) {
1337 case AHC_DEV_Q_BASIC: 1337 case AHC_DEV_Q_BASIC:
1338 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TASK,
1339 dev->openings + dev->active);
1340 break;
1341 case AHC_DEV_Q_TAGGED: 1338 case AHC_DEV_Q_TAGGED:
1342 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TASK, 1339 scsi_adjust_queue_depth(sdev,
1343 dev->openings + dev->active); 1340 dev->openings + dev->active);
1344 break;
1345 default: 1341 default:
1346 /* 1342 /*
1347 * We allow the OS to queue 2 untagged transactions to 1343 * We allow the OS to queue 2 untagged transactions to
@@ -1349,7 +1345,7 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
1349 * serially on the controller/device. This should 1345 * serially on the controller/device. This should
1350 * remove some latency. 1346 * remove some latency.
1351 */ 1347 */
1352 scsi_adjust_queue_depth(sdev, 0, 2); 1348 scsi_adjust_queue_depth(sdev, 2);
1353 break; 1349 break;
1354 } 1350 }
1355} 1351}
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 0b44fb5ee485..209f77162d06 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -122,7 +122,7 @@ static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev,
122 122
123 if (queue_depth > ARCMSR_MAX_CMD_PERLUN) 123 if (queue_depth > ARCMSR_MAX_CMD_PERLUN)
124 queue_depth = ARCMSR_MAX_CMD_PERLUN; 124 queue_depth = ARCMSR_MAX_CMD_PERLUN;
125 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); 125 scsi_adjust_queue_depth(sdev, queue_depth);
126 return queue_depth; 126 return queue_depth;
127} 127}
128 128
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index d8e43c81d19b..87b09cd232cc 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -776,7 +776,7 @@ bfad_thread_workq(struct bfad_s *bfad)
776static int 776static int
777bfad_im_slave_configure(struct scsi_device *sdev) 777bfad_im_slave_configure(struct scsi_device *sdev)
778{ 778{
779 scsi_adjust_queue_depth(sdev, 0, bfa_lun_queue_depth); 779 scsi_adjust_queue_depth(sdev, bfa_lun_queue_depth);
780 return 0; 780 return 0;
781} 781}
782 782
@@ -867,7 +867,6 @@ bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
867 if (tmp_sdev->id != sdev->id) 867 if (tmp_sdev->id != sdev->id)
868 continue; 868 continue;
869 scsi_adjust_queue_depth(tmp_sdev, 869 scsi_adjust_queue_depth(tmp_sdev,
870 MSG_SIMPLE_TAG,
871 tmp_sdev->queue_depth + 1); 870 tmp_sdev->queue_depth + 1);
872 871
873 itnim->last_ramp_up_time = jiffies; 872 itnim->last_ramp_up_time = jiffies;
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index f73155db80a3..44a8cc51428f 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -2241,7 +2241,7 @@ csio_slave_alloc(struct scsi_device *sdev)
2241static int 2241static int
2242csio_slave_configure(struct scsi_device *sdev) 2242csio_slave_configure(struct scsi_device *sdev)
2243{ 2243{
2244 scsi_adjust_queue_depth(sdev, 0, csio_lun_qdepth); 2244 scsi_adjust_queue_depth(sdev, csio_lun_qdepth);
2245 return 0; 2245 return 0;
2246} 2246}
2247 2247
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 072f0ec2851e..1af8d54bcded 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -415,10 +415,8 @@ static int adpt_slave_configure(struct scsi_device * device)
415 pHba = (adpt_hba *) host->hostdata[0]; 415 pHba = (adpt_hba *) host->hostdata[0];
416 416
417 if (host->can_queue && device->tagged_supported) { 417 if (host->can_queue && device->tagged_supported) {
418 scsi_adjust_queue_depth(device, MSG_SIMPLE_TAG, 418 scsi_adjust_queue_depth(device,
419 host->can_queue - 1); 419 host->can_queue - 1);
420 } else {
421 scsi_adjust_queue_depth(device, 0, 1);
422 } 420 }
423 return 0; 421 return 0;
424} 422}
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index 943ad3a19661..bc0f918f1729 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -946,20 +946,18 @@ static int eata2x_slave_configure(struct scsi_device *dev)
946 946
947 if (TLDEV(dev->type) && dev->tagged_supported) { 947 if (TLDEV(dev->type) && dev->tagged_supported) {
948 if (tag_mode == TAG_SIMPLE) { 948 if (tag_mode == TAG_SIMPLE) {
949 scsi_adjust_queue_depth(dev, MSG_SIMPLE_TAG, tqd);
950 tag_suffix = ", simple tags"; 949 tag_suffix = ", simple tags";
951 } else if (tag_mode == TAG_ORDERED) { 950 } else if (tag_mode == TAG_ORDERED) {
952 scsi_adjust_queue_depth(dev, MSG_ORDERED_TAG, tqd);
953 tag_suffix = ", ordered tags"; 951 tag_suffix = ", ordered tags";
954 } else { 952 } else {
955 scsi_adjust_queue_depth(dev, 0, tqd);
956 tag_suffix = ", no tags"; 953 tag_suffix = ", no tags";
957 } 954 }
955 scsi_adjust_queue_depth(dev, tqd);
958 } else if (TLDEV(dev->type) && linked_comm) { 956 } else if (TLDEV(dev->type) && linked_comm) {
959 scsi_adjust_queue_depth(dev, 0, tqd); 957 scsi_adjust_queue_depth(dev, tqd);
960 tag_suffix = ", untagged"; 958 tag_suffix = ", untagged";
961 } else { 959 } else {
962 scsi_adjust_queue_depth(dev, 0, utqd); 960 scsi_adjust_queue_depth(dev, utqd);
963 tag_suffix = ""; 961 tag_suffix = "";
964 } 962 }
965 963
diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h
index 20ab211983f2..1941d837f6f2 100644
--- a/drivers/scsi/esas2r/esas2r.h
+++ b/drivers/scsi/esas2r/esas2r.h
@@ -972,9 +972,6 @@ u8 handle_hba_ioctl(struct esas2r_adapter *a,
972 struct atto_ioctl *ioctl_hba); 972 struct atto_ioctl *ioctl_hba);
973int esas2r_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd); 973int esas2r_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd);
974int esas2r_show_info(struct seq_file *m, struct Scsi_Host *sh); 974int esas2r_show_info(struct seq_file *m, struct Scsi_Host *sh);
975int esas2r_slave_alloc(struct scsi_device *dev);
976int esas2r_slave_configure(struct scsi_device *dev);
977void esas2r_slave_destroy(struct scsi_device *dev);
978int esas2r_change_queue_depth(struct scsi_device *dev, int depth, int reason); 975int esas2r_change_queue_depth(struct scsi_device *dev, int depth, int reason);
979long esas2r_proc_ioctl(struct file *fp, unsigned int cmd, unsigned long arg); 976long esas2r_proc_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
980 977
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index a020b09ba347..30fce64faf75 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -254,9 +254,6 @@ static struct scsi_host_template driver_template = {
254 .use_clustering = ENABLE_CLUSTERING, 254 .use_clustering = ENABLE_CLUSTERING,
255 .emulated = 0, 255 .emulated = 0,
256 .proc_name = ESAS2R_DRVR_NAME, 256 .proc_name = ESAS2R_DRVR_NAME,
257 .slave_configure = esas2r_slave_configure,
258 .slave_alloc = esas2r_slave_alloc,
259 .slave_destroy = esas2r_slave_destroy,
260 .change_queue_depth = esas2r_change_queue_depth, 257 .change_queue_depth = esas2r_change_queue_depth,
261 .change_queue_type = scsi_change_queue_type, 258 .change_queue_type = scsi_change_queue_type,
262 .max_sectors = 0xFFFF, 259 .max_sectors = 0xFFFF,
@@ -1264,35 +1261,11 @@ int esas2r_change_queue_depth(struct scsi_device *dev, int depth, int reason)
1264{ 1261{
1265 esas2r_log(ESAS2R_LOG_INFO, "change_queue_depth %p, %d", dev, depth); 1262 esas2r_log(ESAS2R_LOG_INFO, "change_queue_depth %p, %d", dev, depth);
1266 1263
1267 scsi_adjust_queue_depth(dev, scsi_get_tag_type(dev), depth); 1264 scsi_adjust_queue_depth(dev, depth);
1268 1265
1269 return dev->queue_depth; 1266 return dev->queue_depth;
1270} 1267}
1271 1268
1272int esas2r_slave_alloc(struct scsi_device *dev)
1273{
1274 return 0;
1275}
1276
1277int esas2r_slave_configure(struct scsi_device *dev)
1278{
1279 esas2r_log_dev(ESAS2R_LOG_INFO, &(dev->sdev_gendev),
1280 "esas2r_slave_configure()");
1281
1282 if (dev->tagged_supported)
1283 scsi_adjust_queue_depth(dev, MSG_SIMPLE_TAG, cmd_per_lun);
1284 else
1285 scsi_adjust_queue_depth(dev, 0, cmd_per_lun);
1286
1287 return 0;
1288}
1289
1290void esas2r_slave_destroy(struct scsi_device *dev)
1291{
1292 esas2r_log_dev(ESAS2R_LOG_INFO, &(dev->sdev_gendev),
1293 "esas2r_slave_destroy()");
1294}
1295
1296void esas2r_log_request_failure(struct esas2r_adapter *a, 1269void esas2r_log_request_failure(struct esas2r_adapter *a,
1297 struct esas2r_request *rq) 1270 struct esas2r_request *rq)
1298{ 1271{
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 66b6ce10b259..38c23e0b73af 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2402,27 +2402,14 @@ static int esp_slave_configure(struct scsi_device *dev)
2402{ 2402{
2403 struct esp *esp = shost_priv(dev->host); 2403 struct esp *esp = shost_priv(dev->host);
2404 struct esp_target_data *tp = &esp->target[dev->id]; 2404 struct esp_target_data *tp = &esp->target[dev->id];
2405 int goal_tags, queue_depth;
2406
2407 goal_tags = 0;
2408 2405
2409 if (dev->tagged_supported) { 2406 if (dev->tagged_supported) {
2410 /* XXX make this configurable somehow XXX */ 2407 /* XXX make this configurable somehow XXX */
2411 goal_tags = ESP_DEFAULT_TAGS; 2408 int goal_tags = min(ESP_DEFAULT_TAGS, ESP_MAX_TAG);
2412 2409
2413 if (goal_tags > ESP_MAX_TAG) 2410 scsi_adjust_queue_depth(dev, goal_tags);
2414 goal_tags = ESP_MAX_TAG;
2415 } 2411 }
2416 2412
2417 queue_depth = goal_tags;
2418 if (queue_depth < dev->host->cmd_per_lun)
2419 queue_depth = dev->host->cmd_per_lun;
2420
2421 if (goal_tags) {
2422 scsi_adjust_queue_depth(dev, MSG_ORDERED_TAG, queue_depth);
2423 } else {
2424 scsi_adjust_queue_depth(dev, 0, queue_depth);
2425 }
2426 tp->flags |= ESP_TGT_DISCONNECT; 2413 tp->flags |= ESP_TGT_DISCONNECT;
2427 2414
2428 if (!spi_initial_dv(dev->sdev_target)) 2415 if (!spi_initial_dv(dev->sdev_target))
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 2a6c98b7d4db..0f29e3f89b26 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -100,7 +100,7 @@ static int fnic_slave_alloc(struct scsi_device *sdev)
100 if (!rport || fc_remote_port_chkready(rport)) 100 if (!rport || fc_remote_port_chkready(rport))
101 return -ENXIO; 101 return -ENXIO;
102 102
103 scsi_adjust_queue_depth(sdev, 0, fnic_max_qdepth); 103 scsi_adjust_queue_depth(sdev, fnic_max_qdepth);
104 return 0; 104 return 0;
105} 105}
106 106
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 0f1ae13ce7c7..4ebbeae161e2 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -4661,7 +4661,6 @@ static void gdth_flush(gdth_ha_str *ha)
4661/* configure lun */ 4661/* configure lun */
4662static int gdth_slave_configure(struct scsi_device *sdev) 4662static int gdth_slave_configure(struct scsi_device *sdev)
4663{ 4663{
4664 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
4665 sdev->skip_ms_page_3f = 1; 4664 sdev->skip_ms_page_3f = 1;
4666 sdev->skip_ms_page_8 = 1; 4665 sdev->skip_ms_page_8 = 1;
4667 return 0; 4666 return 0;
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index cef5d49b59cd..18ea2e16e34f 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4165,7 +4165,7 @@ static int hpsa_change_queue_depth(struct scsi_device *sdev,
4165 else 4165 else
4166 if (qdepth > h->nr_cmds) 4166 if (qdepth > h->nr_cmds)
4167 qdepth = h->nr_cmds; 4167 qdepth = h->nr_cmds;
4168 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 4168 scsi_adjust_queue_depth(sdev, qdepth);
4169 return sdev->queue_depth; 4169 return sdev->queue_depth;
4170} 4170}
4171 4171
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index dedb62c21b29..151893148abd 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1127,7 +1127,7 @@ static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev,
1127 1127
1128 if (queue_depth > hba->max_requests) 1128 if (queue_depth > hba->max_requests)
1129 queue_depth = hba->max_requests; 1129 queue_depth = hba->max_requests;
1130 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); 1130 scsi_adjust_queue_depth(sdev, queue_depth);
1131 return queue_depth; 1131 return queue_depth;
1132} 1132}
1133 1133
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 4723d89df5ac..147b80e07b00 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -2887,12 +2887,6 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev)
2887 spin_lock_irqsave(shost->host_lock, flags); 2887 spin_lock_irqsave(shost->host_lock, flags);
2888 if (sdev->type == TYPE_DISK) 2888 if (sdev->type == TYPE_DISK)
2889 sdev->allow_restart = 1; 2889 sdev->allow_restart = 1;
2890
2891 if (sdev->tagged_supported)
2892 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG,
2893 sdev->queue_depth);
2894 else
2895 scsi_adjust_queue_depth(sdev, 0, sdev->queue_depth);
2896 spin_unlock_irqrestore(shost->host_lock, flags); 2890 spin_unlock_irqrestore(shost->host_lock, flags);
2897 return 0; 2891 return 0;
2898} 2892}
@@ -2915,7 +2909,7 @@ static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth,
2915 if (qdepth > IBMVFC_MAX_CMDS_PER_LUN) 2909 if (qdepth > IBMVFC_MAX_CMDS_PER_LUN)
2916 qdepth = IBMVFC_MAX_CMDS_PER_LUN; 2910 qdepth = IBMVFC_MAX_CMDS_PER_LUN;
2917 2911
2918 scsi_adjust_queue_depth(sdev, 0, qdepth); 2912 scsi_adjust_queue_depth(sdev, qdepth);
2919 return sdev->queue_depth; 2913 return sdev->queue_depth;
2920} 2914}
2921 2915
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 7b23f21f22f1..e8c3cdf0d03b 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1929,7 +1929,6 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev)
1929 blk_queue_rq_timeout(sdev->request_queue, 120 * HZ); 1929 blk_queue_rq_timeout(sdev->request_queue, 120 * HZ);
1930 } 1930 }
1931 spin_unlock_irqrestore(shost->host_lock, lock_flags); 1931 spin_unlock_irqrestore(shost->host_lock, lock_flags);
1932 scsi_adjust_queue_depth(sdev, 0, shost->cmd_per_lun);
1933 return 0; 1932 return 0;
1934} 1933}
1935 1934
@@ -1951,7 +1950,7 @@ static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth,
1951 if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN) 1950 if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN)
1952 qdepth = IBMVSCSI_MAX_CMDS_PER_LUN; 1951 qdepth = IBMVSCSI_MAX_CMDS_PER_LUN;
1953 1952
1954 scsi_adjust_queue_depth(sdev, 0, qdepth); 1953 scsi_adjust_queue_depth(sdev, qdepth);
1955 return sdev->queue_depth; 1954 return sdev->queue_depth;
1956} 1955}
1957 1956
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index f84fcb9a6ed7..256ef98f5c29 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -4344,7 +4344,7 @@ static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth,
4344 qdepth = IPR_MAX_CMD_PER_ATA_LUN; 4344 qdepth = IPR_MAX_CMD_PER_ATA_LUN;
4345 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 4345 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
4346 4346
4347 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 4347 scsi_adjust_queue_depth(sdev, qdepth);
4348 return sdev->queue_depth; 4348 return sdev->queue_depth;
4349} 4349}
4350 4350
@@ -4751,10 +4751,10 @@ static int ipr_slave_configure(struct scsi_device *sdev)
4751 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 4751 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
4752 4752
4753 if (ap) { 4753 if (ap) {
4754 scsi_adjust_queue_depth(sdev, 0, IPR_MAX_CMD_PER_ATA_LUN); 4754 scsi_adjust_queue_depth(sdev, IPR_MAX_CMD_PER_ATA_LUN);
4755 ata_sas_slave_configure(sdev, ap); 4755 ata_sas_slave_configure(sdev, ap);
4756 } else 4756 }
4757 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); 4757
4758 if (ioa_cfg->sis64) 4758 if (ioa_cfg->sis64)
4759 sdev_printk(KERN_INFO, sdev, "Resource path: %s\n", 4759 sdev_printk(KERN_INFO, sdev, "Resource path: %s\n",
4760 ipr_format_res_path(ioa_cfg, 4760 ipr_format_res_path(ioa_cfg,
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index e5afc3884d74..454741a8da45 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -1210,7 +1210,7 @@ ips_slave_configure(struct scsi_device * SDptr)
1210 min = ha->max_cmds / 2; 1210 min = ha->max_cmds / 2;
1211 if (ha->enq->ucLogDriveCount <= 2) 1211 if (ha->enq->ucLogDriveCount <= 2)
1212 min = ha->max_cmds - 1; 1212 min = ha->max_cmds - 1;
1213 scsi_adjust_queue_depth(SDptr, MSG_ORDERED_TAG, min); 1213 scsi_adjust_queue_depth(SDptr, min);
1214 } 1214 }
1215 1215
1216 SDptr->skip_ms_page_8 = 1; 1216 SDptr->skip_ms_page_8 = 1;
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index d4bb642f2681..bf954ee050f8 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2160,7 +2160,7 @@ int fc_slave_alloc(struct scsi_device *sdev)
2160 if (!rport || fc_remote_port_chkready(rport)) 2160 if (!rport || fc_remote_port_chkready(rport))
2161 return -ENXIO; 2161 return -ENXIO;
2162 2162
2163 scsi_adjust_queue_depth(sdev, 0, FC_FCP_DFLT_QUEUE_DEPTH); 2163 scsi_adjust_queue_depth(sdev, FC_FCP_DFLT_QUEUE_DEPTH);
2164 return 0; 2164 return 0;
2165} 2165}
2166EXPORT_SYMBOL(fc_slave_alloc); 2166EXPORT_SYMBOL(fc_slave_alloc);
@@ -2175,13 +2175,13 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
2175{ 2175{
2176 switch (reason) { 2176 switch (reason) {
2177 case SCSI_QDEPTH_DEFAULT: 2177 case SCSI_QDEPTH_DEFAULT:
2178 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 2178 scsi_adjust_queue_depth(sdev, qdepth);
2179 break; 2179 break;
2180 case SCSI_QDEPTH_QFULL: 2180 case SCSI_QDEPTH_QFULL:
2181 scsi_track_queue_full(sdev, qdepth); 2181 scsi_track_queue_full(sdev, qdepth);
2182 break; 2182 break;
2183 case SCSI_QDEPTH_RAMP_UP: 2183 case SCSI_QDEPTH_RAMP_UP:
2184 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 2184 scsi_adjust_queue_depth(sdev, qdepth);
2185 break; 2185 break;
2186 default: 2186 default:
2187 return -EOPNOTSUPP; 2187 return -EOPNOTSUPP;
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 0d8bc6c66650..d521624dedfb 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1775,13 +1775,13 @@ int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
1775{ 1775{
1776 switch (reason) { 1776 switch (reason) {
1777 case SCSI_QDEPTH_DEFAULT: 1777 case SCSI_QDEPTH_DEFAULT:
1778 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); 1778 scsi_adjust_queue_depth(sdev, depth);
1779 break; 1779 break;
1780 case SCSI_QDEPTH_QFULL: 1780 case SCSI_QDEPTH_QFULL:
1781 scsi_track_queue_full(sdev, depth); 1781 scsi_track_queue_full(sdev, depth);
1782 break; 1782 break;
1783 case SCSI_QDEPTH_RAMP_UP: 1783 case SCSI_QDEPTH_RAMP_UP:
1784 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); 1784 scsi_adjust_queue_depth(sdev, depth);
1785 break; 1785 break;
1786 default: 1786 default:
1787 return -EOPNOTSUPP; 1787 return -EOPNOTSUPP;
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index eee21a060d93..56d698af073d 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -940,13 +940,13 @@ int sas_slave_configure(struct scsi_device *scsi_dev)
940 sas_read_port_mode_page(scsi_dev); 940 sas_read_port_mode_page(scsi_dev);
941 941
942 if (scsi_dev->tagged_supported) { 942 if (scsi_dev->tagged_supported) {
943 scsi_adjust_queue_depth(scsi_dev, MSG_SIMPLE_TAG, SAS_DEF_QD); 943 scsi_adjust_queue_depth(scsi_dev, SAS_DEF_QD);
944 } else { 944 } else {
945 SAS_DPRINTK("device %llx, LUN %llx doesn't support " 945 SAS_DPRINTK("device %llx, LUN %llx doesn't support "
946 "TCQ\n", SAS_ADDR(dev->sas_addr), 946 "TCQ\n", SAS_ADDR(dev->sas_addr),
947 scsi_dev->lun); 947 scsi_dev->lun);
948 scsi_dev->tagged_supported = 0; 948 scsi_dev->tagged_supported = 0;
949 scsi_adjust_queue_depth(scsi_dev, 0, 1); 949 scsi_adjust_queue_depth(scsi_dev, 1);
950 } 950 }
951 951
952 scsi_dev->allow_restart = 1; 952 scsi_dev->allow_restart = 1;
@@ -967,7 +967,7 @@ int sas_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
967 case SCSI_QDEPTH_RAMP_UP: 967 case SCSI_QDEPTH_RAMP_UP:
968 if (!sdev->tagged_supported) 968 if (!sdev->tagged_supported)
969 depth = 1; 969 depth = 1;
970 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); 970 scsi_adjust_queue_depth(sdev, depth);
971 break; 971 break;
972 case SCSI_QDEPTH_QFULL: 972 case SCSI_QDEPTH_QFULL:
973 scsi_track_queue_full(sdev, depth); 973 scsi_track_queue_full(sdev, depth);
@@ -979,19 +979,11 @@ int sas_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
979 return depth; 979 return depth;
980} 980}
981 981
982int sas_change_queue_type(struct scsi_device *scsi_dev, int qt) 982int sas_change_queue_type(struct scsi_device *scsi_dev, int type)
983{ 983{
984 struct domain_device *dev = sdev_to_domain_dev(scsi_dev); 984 if (dev_is_sata(sdev_to_domain_dev(scsi_dev)))
985
986 if (dev_is_sata(dev))
987 return -EINVAL; 985 return -EINVAL;
988 986 return scsi_change_queue_type(scsi_dev, type);
989 if (!scsi_dev->tagged_supported)
990 return 0;
991
992 scsi_adjust_queue_depth(scsi_dev, qt, scsi_dev->queue_depth);
993
994 return qt;
995} 987}
996 988
997int sas_bios_param(struct scsi_device *scsi_dev, 989int sas_bios_param(struct scsi_device *scsi_dev,
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index a24106a70968..8533ee9b818d 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -320,7 +320,7 @@ lpfc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
320 case SCSI_QDEPTH_DEFAULT: 320 case SCSI_QDEPTH_DEFAULT:
321 /* change request from sysfs, fall through */ 321 /* change request from sysfs, fall through */
322 case SCSI_QDEPTH_RAMP_UP: 322 case SCSI_QDEPTH_RAMP_UP:
323 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 323 scsi_adjust_queue_depth(sdev, qdepth);
324 break; 324 break;
325 case SCSI_QDEPTH_QFULL: 325 case SCSI_QDEPTH_QFULL:
326 if (scsi_track_queue_full(sdev, qdepth) == 0) 326 if (scsi_track_queue_full(sdev, qdepth) == 0)
@@ -5598,7 +5598,7 @@ lpfc_slave_configure(struct scsi_device *sdev)
5598 struct lpfc_vport *vport = (struct lpfc_vport *) sdev->host->hostdata; 5598 struct lpfc_vport *vport = (struct lpfc_vport *) sdev->host->hostdata;
5599 struct lpfc_hba *phba = vport->phba; 5599 struct lpfc_hba *phba = vport->phba;
5600 5600
5601 scsi_adjust_queue_depth(sdev, 0, vport->cfg_lun_queue_depth); 5601 scsi_adjust_queue_depth(sdev, vport->cfg_lun_queue_depth);
5602 5602
5603 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { 5603 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
5604 lpfc_sli_handle_fast_ring_event(phba, 5604 lpfc_sli_handle_fast_ring_event(phba,
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 531dce419c18..6b077d839f2b 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -349,7 +349,7 @@ static int megaraid_change_queue_depth(struct scsi_device *sdev, int qdepth,
349 349
350 if (qdepth > MBOX_MAX_SCSI_CMDS) 350 if (qdepth > MBOX_MAX_SCSI_CMDS)
351 qdepth = MBOX_MAX_SCSI_CMDS; 351 qdepth = MBOX_MAX_SCSI_CMDS;
352 scsi_adjust_queue_depth(sdev, 0, qdepth); 352 scsi_adjust_queue_depth(sdev, qdepth);
353 return sdev->queue_depth; 353 return sdev->queue_depth;
354} 354}
355 355
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 5640ad1c8214..107244cebd22 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -2594,8 +2594,7 @@ static int megasas_change_queue_depth(struct scsi_device *sdev,
2594 2594
2595 if (queue_depth > sdev->host->can_queue) 2595 if (queue_depth > sdev->host->can_queue)
2596 queue_depth = sdev->host->can_queue; 2596 queue_depth = sdev->host->can_queue;
2597 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), 2597 scsi_adjust_queue_depth(sdev, queue_depth);
2598 queue_depth);
2599 2598
2600 return queue_depth; 2599 return queue_depth;
2601} 2600}
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 69dc166b52bc..42fef914d441 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -1222,7 +1222,7 @@ _scsih_adjust_queue_depth(struct scsi_device *sdev, int qdepth)
1222 max_depth = 1; 1222 max_depth = 1;
1223 if (qdepth > max_depth) 1223 if (qdepth > max_depth)
1224 qdepth = max_depth; 1224 qdepth = max_depth;
1225 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 1225 scsi_adjust_queue_depth(sdev, qdepth);
1226} 1226}
1227 1227
1228/** 1228/**
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index d3abf254341d..b23c2e7588e5 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -1090,7 +1090,7 @@ _scsih_adjust_queue_depth(struct scsi_device *sdev, int qdepth)
1090 max_depth = 1; 1090 max_depth = 1;
1091 if (qdepth > max_depth) 1091 if (qdepth > max_depth)
1092 qdepth = max_depth; 1092 qdepth = max_depth;
1093 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 1093 scsi_adjust_queue_depth(sdev, qdepth);
1094} 1094}
1095 1095
1096/** 1096/**
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index a7305ffc359d..9c331b7bfdcd 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -7997,10 +7997,7 @@ static int ncr53c8xx_slave_configure(struct scsi_device *device)
7997 if (depth_to_use > MAX_TAGS) 7997 if (depth_to_use > MAX_TAGS)
7998 depth_to_use = MAX_TAGS; 7998 depth_to_use = MAX_TAGS;
7999 7999
8000 scsi_adjust_queue_depth(device, 8000 scsi_adjust_queue_depth(device, depth_to_use);
8001 (device->tagged_supported ?
8002 MSG_SIMPLE_TAG : 0),
8003 depth_to_use);
8004 8001
8005 /* 8002 /*
8006 ** Since the queue depth is not tunable under Linux, 8003 ** Since the queue depth is not tunable under Linux,
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 71f9f59b13c6..d8b9ba251fbd 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -249,14 +249,11 @@ static int pmcraid_slave_configure(struct scsi_device *scsi_dev)
249 PMCRAID_VSET_MAX_SECTORS); 249 PMCRAID_VSET_MAX_SECTORS);
250 } 250 }
251 251
252 if (scsi_dev->tagged_supported && 252 /*
253 (RES_IS_GSCSI(res->cfg_entry) || RES_IS_VSET(res->cfg_entry))) { 253 * We never want to report TCQ support for these types of devices.
254 scsi_adjust_queue_depth(scsi_dev, MSG_SIMPLE_TAG, 254 */
255 scsi_dev->host->cmd_per_lun); 255 if (!RES_IS_GSCSI(res->cfg_entry) && !RES_IS_VSET(res->cfg_entry))
256 } else { 256 scsi_dev->tagged_supported = 0;
257 scsi_adjust_queue_depth(scsi_dev, 0,
258 scsi_dev->host->cmd_per_lun);
259 }
260 257
261 return 0; 258 return 0;
262} 259}
@@ -302,35 +299,12 @@ static int pmcraid_change_queue_depth(struct scsi_device *scsi_dev, int depth,
302 if (depth > PMCRAID_MAX_CMD_PER_LUN) 299 if (depth > PMCRAID_MAX_CMD_PER_LUN)
303 depth = PMCRAID_MAX_CMD_PER_LUN; 300 depth = PMCRAID_MAX_CMD_PER_LUN;
304 301
305 scsi_adjust_queue_depth(scsi_dev, scsi_get_tag_type(scsi_dev), depth); 302 scsi_adjust_queue_depth(scsi_dev, depth);
306 303
307 return scsi_dev->queue_depth; 304 return scsi_dev->queue_depth;
308} 305}
309 306
310/** 307/**
311 * pmcraid_change_queue_type - Change the device's queue type
312 * @scsi_dev: scsi device struct
313 * @tag: type of tags to use
314 *
315 * Return value:
316 * actual queue type set
317 */
318static int pmcraid_change_queue_type(struct scsi_device *scsi_dev, int tag)
319{
320 struct pmcraid_resource_entry *res;
321
322 res = (struct pmcraid_resource_entry *)scsi_dev->hostdata;
323 if (res && scsi_dev->tagged_supported &&
324 (RES_IS_GSCSI(res->cfg_entry) || RES_IS_VSET(res->cfg_entry)))
325 tag = scsi_change_queue_type(scsi_dev, tag);
326 else
327 tag = 0;
328
329 return tag;
330}
331
332
333/**
334 * pmcraid_init_cmdblk - initializes a command block 308 * pmcraid_init_cmdblk - initializes a command block
335 * 309 *
336 * @cmd: pointer to struct pmcraid_cmd to be initialized 310 * @cmd: pointer to struct pmcraid_cmd to be initialized
@@ -4285,7 +4259,7 @@ static struct scsi_host_template pmcraid_host_template = {
4285 .slave_configure = pmcraid_slave_configure, 4259 .slave_configure = pmcraid_slave_configure,
4286 .slave_destroy = pmcraid_slave_destroy, 4260 .slave_destroy = pmcraid_slave_destroy,
4287 .change_queue_depth = pmcraid_change_queue_depth, 4261 .change_queue_depth = pmcraid_change_queue_depth,
4288 .change_queue_type = pmcraid_change_queue_type, 4262 .change_queue_type = scsi_change_queue_type,
4289 .can_queue = PMCRAID_MAX_IO_CMD, 4263 .can_queue = PMCRAID_MAX_IO_CMD,
4290 .this_id = -1, 4264 .this_id = -1,
4291 .sg_tablesize = PMCRAID_MAX_IOADLS, 4265 .sg_tablesize = PMCRAID_MAX_IOADLS,
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 158020522dfb..adedb6ef8eec 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -1224,10 +1224,9 @@ qla1280_slave_configure(struct scsi_device *device)
1224 1224
1225 if (device->tagged_supported && 1225 if (device->tagged_supported &&
1226 (ha->bus_settings[bus].qtag_enables & (BIT_0 << target))) { 1226 (ha->bus_settings[bus].qtag_enables & (BIT_0 << target))) {
1227 scsi_adjust_queue_depth(device, MSG_ORDERED_TAG, 1227 scsi_adjust_queue_depth(device, ha->bus_settings[bus].hiwat);
1228 ha->bus_settings[bus].hiwat);
1229 } else { 1228 } else {
1230 scsi_adjust_queue_depth(device, 0, default_depth); 1229 scsi_adjust_queue_depth(device, default_depth);
1231 } 1230 }
1232 1231
1233 nv->bus[bus].target[target].parameter.enable_sync = device->sdtr; 1232 nv->bus[bus].target[target].parameter.enable_sync = device->sdtr;
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index eb0465305f8d..33166ebec7d8 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1405,7 +1405,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
1405 if (IS_T10_PI_CAPABLE(vha->hw)) 1405 if (IS_T10_PI_CAPABLE(vha->hw))
1406 blk_queue_update_dma_alignment(sdev->request_queue, 0x7); 1406 blk_queue_update_dma_alignment(sdev->request_queue, 0x7);
1407 1407
1408 scsi_adjust_queue_depth(sdev, 0, req->max_q_depth); 1408 scsi_adjust_queue_depth(sdev, req->max_q_depth);
1409 return 0; 1409 return 0;
1410} 1410}
1411 1411
@@ -1440,7 +1440,7 @@ static void qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, int qdepth)
1440 if (req->max_q_depth <= sdev->queue_depth || req->max_q_depth < qdepth) 1440 if (req->max_q_depth <= sdev->queue_depth || req->max_q_depth < qdepth)
1441 return; 1441 return;
1442 1442
1443 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, qdepth); 1443 scsi_adjust_queue_depth(sdev, qdepth);
1444 1444
1445 ql_dbg(ql_dbg_io, vha, 0x302a, 1445 ql_dbg(ql_dbg_io, vha, 0x302a,
1446 "Queue depth adjusted-up to %d for nexus=%ld:%d:%llu.\n", 1446 "Queue depth adjusted-up to %d for nexus=%ld:%d:%llu.\n",
@@ -1452,7 +1452,7 @@ qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
1452{ 1452{
1453 switch (reason) { 1453 switch (reason) {
1454 case SCSI_QDEPTH_DEFAULT: 1454 case SCSI_QDEPTH_DEFAULT:
1455 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 1455 scsi_adjust_queue_depth(sdev, qdepth);
1456 break; 1456 break;
1457 case SCSI_QDEPTH_QFULL: 1457 case SCSI_QDEPTH_QFULL:
1458 qla2x00_handle_queue_full(sdev, qdepth); 1458 qla2x00_handle_queue_full(sdev, qdepth);
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index f3119c144e29..784f59e55510 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -9064,7 +9064,7 @@ static int qla4xxx_slave_alloc(struct scsi_device *sdev)
9064 if (ql4xmaxqdepth != 0 && ql4xmaxqdepth <= 0xffffU) 9064 if (ql4xmaxqdepth != 0 && ql4xmaxqdepth <= 0xffffU)
9065 queue_depth = ql4xmaxqdepth; 9065 queue_depth = ql4xmaxqdepth;
9066 9066
9067 scsi_adjust_queue_depth(sdev, 0, queue_depth); 9067 scsi_adjust_queue_depth(sdev, queue_depth);
9068 return 0; 9068 return 0;
9069} 9069}
9070 9070
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index a3426f1bf0dd..106fa2f886d2 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -744,8 +744,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
744/** 744/**
745 * scsi_adjust_queue_depth - Let low level drivers change a device's queue depth 745 * scsi_adjust_queue_depth - Let low level drivers change a device's queue depth
746 * @sdev: SCSI Device in question 746 * @sdev: SCSI Device in question
747 * @tagged: Do we use tagged queueing (non-0) or do we treat
748 * this device as an untagged device (0)
749 * @tags: Number of tags allowed if tagged queueing enabled, 747 * @tags: Number of tags allowed if tagged queueing enabled,
750 * or number of commands the low level driver can 748 * or number of commands the low level driver can
751 * queue up in non-tagged mode (as per cmd_per_lun). 749 * queue up in non-tagged mode (as per cmd_per_lun).
@@ -759,7 +757,7 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
759 * currently active and whether or not it even has the 757 * currently active and whether or not it even has the
760 * command blocks built yet. 758 * command blocks built yet.
761 */ 759 */
762void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags) 760void scsi_adjust_queue_depth(struct scsi_device *sdev, int tags)
763{ 761{
764 unsigned long flags; 762 unsigned long flags;
765 763
@@ -787,20 +785,6 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags)
787 } 785 }
788 786
789 sdev->queue_depth = tags; 787 sdev->queue_depth = tags;
790 switch (tagged) {
791 case 0:
792 sdev->simple_tags = 0;
793 break;
794 case MSG_ORDERED_TAG:
795 case MSG_SIMPLE_TAG:
796 sdev->simple_tags = 1;
797 break;
798 default:
799 sdev->simple_tags = 0;
800 sdev_printk(KERN_WARNING, sdev,
801 "scsi_adjust_queue_depth, bad queue type, "
802 "disabled\n");
803 }
804 out: 788 out:
805 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); 789 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
806} 790}
@@ -848,11 +832,12 @@ int scsi_track_queue_full(struct scsi_device *sdev, int depth)
848 return 0; 832 return 0;
849 if (sdev->last_queue_full_depth < 8) { 833 if (sdev->last_queue_full_depth < 8) {
850 /* Drop back to untagged */ 834 /* Drop back to untagged */
851 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); 835 scsi_set_tag_type(sdev, 0);
836 scsi_adjust_queue_depth(sdev, sdev->host->cmd_per_lun);
852 return -1; 837 return -1;
853 } 838 }
854 839
855 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); 840 scsi_adjust_queue_depth(sdev, depth);
856 return depth; 841 return depth;
857} 842}
858EXPORT_SYMBOL(scsi_track_queue_full); 843EXPORT_SYMBOL(scsi_track_queue_full);
@@ -867,7 +852,7 @@ int scsi_change_queue_type(struct scsi_device *sdev, int tag_type)
867 if (!sdev->tagged_supported) 852 if (!sdev->tagged_supported)
868 return 0; 853 return 0;
869 854
870 scsi_adjust_queue_depth(sdev, tag_type, sdev->queue_depth); 855 scsi_set_tag_type(sdev, tag_type);
871 return tag_type; 856 return tag_type;
872 857
873} 858}
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 7bcace2cdd53..fce4e47becc7 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2700,11 +2700,8 @@ static int scsi_debug_slave_configure(struct scsi_device *sdp)
2700 devip = devInfoReg(sdp); 2700 devip = devInfoReg(sdp);
2701 if (NULL == devip) 2701 if (NULL == devip)
2702 return 1; /* no resources, will be marked offline */ 2702 return 1; /* no resources, will be marked offline */
2703 sdp->hostdata = devip;
2704 sdp->tagged_supported = 1; 2703 sdp->tagged_supported = 1;
2705 if (sdp->host->cmd_per_lun) 2704 sdp->hostdata = devip;
2706 scsi_adjust_queue_depth(sdp, DEF_TAGGED_QUEUING,
2707 DEF_CMD_PER_LUN);
2708 blk_queue_max_segment_size(sdp->request_queue, -1U); 2705 blk_queue_max_segment_size(sdp->request_queue, -1U);
2709 if (scsi_debug_no_uld) 2706 if (scsi_debug_no_uld)
2710 sdp->no_uld_attach = 1; 2707 sdp->no_uld_attach = 1;
@@ -4494,7 +4491,7 @@ sdebug_change_qdepth(struct scsi_device *sdev, int qdepth, int reason)
4494 /* allow to exceed max host queued_arr elements for testing */ 4491 /* allow to exceed max host queued_arr elements for testing */
4495 if (qdepth > SCSI_DEBUG_CANQUEUE + 10) 4492 if (qdepth > SCSI_DEBUG_CANQUEUE + 10)
4496 qdepth = SCSI_DEBUG_CANQUEUE + 10; 4493 qdepth = SCSI_DEBUG_CANQUEUE + 10;
4497 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 4494 scsi_adjust_queue_depth(sdev, qdepth);
4498 } else if (reason == SCSI_QDEPTH_QFULL) 4495 } else if (reason == SCSI_QDEPTH_QFULL)
4499 scsi_track_queue_full(sdev, qdepth); 4496 scsi_track_queue_full(sdev, qdepth);
4500 else 4497 else
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 408891cb14ff..d97597e6337e 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -292,7 +292,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
292 blk_queue_init_tags(sdev->request_queue, 292 blk_queue_init_tags(sdev->request_queue,
293 sdev->host->cmd_per_lun, shost->bqt); 293 sdev->host->cmd_per_lun, shost->bqt);
294 } 294 }
295 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); 295 scsi_adjust_queue_depth(sdev, sdev->host->cmd_per_lun);
296 296
297 scsi_sysfs_device_initialize(sdev); 297 scsi_sysfs_device_initialize(sdev);
298 298
@@ -880,8 +880,10 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
880 (inq_result[3] & 0x0f) == 1 ? " CCS" : ""); 880 (inq_result[3] & 0x0f) == 1 ? " CCS" : "");
881 881
882 if ((sdev->scsi_level >= SCSI_2) && (inq_result[7] & 2) && 882 if ((sdev->scsi_level >= SCSI_2) && (inq_result[7] & 2) &&
883 !(*bflags & BLIST_NOTQ)) 883 !(*bflags & BLIST_NOTQ)) {
884 sdev->tagged_supported = 1; 884 sdev->tagged_supported = 1;
885 sdev->simple_tags = 1;
886 }
885 887
886 /* 888 /*
887 * Some devices (Texel CD ROM drives) have handshaking problems 889 * Some devices (Texel CD ROM drives) have handshaking problems
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index b5eae4f6ba46..2bb8a9e74dac 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -549,8 +549,6 @@ stex_slave_alloc(struct scsi_device *sdev)
549 /* Cheat: usually extracted from Inquiry data */ 549 /* Cheat: usually extracted from Inquiry data */
550 sdev->tagged_supported = 1; 550 sdev->tagged_supported = 1;
551 551
552 scsi_adjust_queue_depth(sdev, 0, sdev->host->can_queue);
553
554 return 0; 552 return 0;
555} 553}
556 554
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 37f5fd8ed765..ff8befbdf17c 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1429,8 +1429,7 @@ static void storvsc_device_destroy(struct scsi_device *sdevice)
1429 1429
1430static int storvsc_device_configure(struct scsi_device *sdevice) 1430static int storvsc_device_configure(struct scsi_device *sdevice)
1431{ 1431{
1432 scsi_adjust_queue_depth(sdevice, MSG_SIMPLE_TAG, 1432 scsi_adjust_queue_depth(sdevice, STORVSC_MAX_IO_REQUESTS);
1433 STORVSC_MAX_IO_REQUESTS);
1434 1433
1435 blk_queue_max_segment_size(sdevice->request_queue, PAGE_SIZE); 1434 blk_queue_max_segment_size(sdevice->request_queue, PAGE_SIZE);
1436 1435
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index e59e6f96b725..3557b385251a 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -820,9 +820,7 @@ static int sym53c8xx_slave_configure(struct scsi_device *sdev)
820 if (reqtags > SYM_CONF_MAX_TAG) 820 if (reqtags > SYM_CONF_MAX_TAG)
821 reqtags = SYM_CONF_MAX_TAG; 821 reqtags = SYM_CONF_MAX_TAG;
822 depth_to_use = reqtags ? reqtags : 1; 822 depth_to_use = reqtags ? reqtags : 1;
823 scsi_adjust_queue_depth(sdev, 823 scsi_adjust_queue_depth(sdev, depth_to_use);
824 sdev->tagged_supported ? MSG_SIMPLE_TAG : 0,
825 depth_to_use);
826 lp->s.scdev_depth = depth_to_use; 824 lp->s.scdev_depth = depth_to_use;
827 sym_tune_dev_queuing(tp, sdev->lun, reqtags); 825 sym_tune_dev_queuing(tp, sdev->lun, reqtags);
828 826
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index 6369f9a282f1..844c9a048c00 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -2185,9 +2185,16 @@ static int dc390_slave_configure(struct scsi_device *sdev)
2185 struct dc390_dcb *dcb = (struct dc390_dcb *)sdev->hostdata; 2185 struct dc390_dcb *dcb = (struct dc390_dcb *)sdev->hostdata;
2186 2186
2187 acb->scan_devices = 0; 2187 acb->scan_devices = 0;
2188
2189 /*
2190 * XXX: Note that while this driver used to called scsi_activate_tcq,
2191 * it never actually set a tag type, so emulate the old behavior.
2192 */
2193 scsi_set_tag_type(sdev, 0);
2194
2188 if (sdev->tagged_supported && (dcb->DevMode & TAG_QUEUEING_)) { 2195 if (sdev->tagged_supported && (dcb->DevMode & TAG_QUEUEING_)) {
2189 dcb->SyncMode |= EN_TAG_QUEUEING; 2196 dcb->SyncMode |= EN_TAG_QUEUEING;
2190 scsi_adjust_queue_depth(sdev, 0, acb->TagMaxNum); 2197 scsi_adjust_queue_depth(sdev, acb->TagMaxNum);
2191 } 2198 }
2192 2199
2193 return 0; 2200 return 0;
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index d8dcf36aed11..aa0f4035afaf 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -696,25 +696,25 @@ static int u14_34f_slave_configure(struct scsi_device *dev) {
696 if (TLDEV(dev->type) && dev->tagged_supported) 696 if (TLDEV(dev->type) && dev->tagged_supported)
697 697
698 if (tag_mode == TAG_SIMPLE) { 698 if (tag_mode == TAG_SIMPLE) {
699 scsi_adjust_queue_depth(dev, MSG_SIMPLE_TAG, tqd); 699 scsi_adjust_queue_depth(dev, tqd);
700 tag_suffix = ", simple tags"; 700 tag_suffix = ", simple tags";
701 } 701 }
702 else if (tag_mode == TAG_ORDERED) { 702 else if (tag_mode == TAG_ORDERED) {
703 scsi_adjust_queue_depth(dev, MSG_ORDERED_TAG, tqd); 703 scsi_adjust_queue_depth(dev, tqd);
704 tag_suffix = ", ordered tags"; 704 tag_suffix = ", ordered tags";
705 } 705 }
706 else { 706 else {
707 scsi_adjust_queue_depth(dev, 0, tqd); 707 scsi_adjust_queue_depth(dev, tqd);
708 tag_suffix = ", no tags"; 708 tag_suffix = ", no tags";
709 } 709 }
710 710
711 else if (TLDEV(dev->type) && linked_comm) { 711 else if (TLDEV(dev->type) && linked_comm) {
712 scsi_adjust_queue_depth(dev, 0, tqd); 712 scsi_adjust_queue_depth(dev, tqd);
713 tag_suffix = ", untagged"; 713 tag_suffix = ", untagged";
714 } 714 }
715 715
716 else { 716 else {
717 scsi_adjust_queue_depth(dev, 0, utqd); 717 scsi_adjust_queue_depth(dev, utqd);
718 tag_suffix = ""; 718 tag_suffix = "";
719 } 719 }
720 720
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 48c7f9e8f256..5eb4931e2adc 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2696,7 +2696,7 @@ static void ufshcd_set_queue_depth(struct scsi_device *sdev)
2696 dev_dbg(hba->dev, "%s: activate tcq with queue depth %d\n", 2696 dev_dbg(hba->dev, "%s: activate tcq with queue depth %d\n",
2697 __func__, lun_qdepth); 2697 __func__, lun_qdepth);
2698 if (sdev->tagged_supported) 2698 if (sdev->tagged_supported)
2699 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), lun_qdepth); 2699 scsi_adjust_queue_depth(sdev, lun_qdepth);
2700} 2700}
2701 2701
2702/* 2702/*
@@ -2808,7 +2808,7 @@ static int ufshcd_change_queue_depth(struct scsi_device *sdev,
2808 case SCSI_QDEPTH_RAMP_UP: 2808 case SCSI_QDEPTH_RAMP_UP:
2809 if (!sdev->tagged_supported) 2809 if (!sdev->tagged_supported)
2810 depth = 1; 2810 depth = 1;
2811 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); 2811 scsi_adjust_queue_depth(sdev, depth);
2812 break; 2812 break;
2813 case SCSI_QDEPTH_QFULL: 2813 case SCSI_QDEPTH_QFULL:
2814 scsi_track_queue_full(sdev, depth); 2814 scsi_track_queue_full(sdev, depth);
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index b83846fc7859..355afbc7fde1 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -683,9 +683,7 @@ static int virtscsi_change_queue_depth(struct scsi_device *sdev,
683 break; 683 break;
684 case SCSI_QDEPTH_RAMP_UP: /* Raise qdepth after BUSY state resolved */ 684 case SCSI_QDEPTH_RAMP_UP: /* Raise qdepth after BUSY state resolved */
685 case SCSI_QDEPTH_DEFAULT: /* Manual change via sysfs */ 685 case SCSI_QDEPTH_DEFAULT: /* Manual change via sysfs */
686 scsi_adjust_queue_depth(sdev, 686 scsi_adjust_queue_depth(sdev, min(max_depth, qdepth));
687 scsi_get_tag_type(sdev),
688 min(max_depth, qdepth));
689 break; 687 break;
690 default: 688 default:
691 return -EOPNOTSUPP; 689 return -EOPNOTSUPP;
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index 53a3eb6c0634..c3b4f8b3a3a5 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -522,7 +522,7 @@ static int pvscsi_change_queue_depth(struct scsi_device *sdev,
522 max_depth = 1; 522 max_depth = 1;
523 if (qdepth > max_depth) 523 if (qdepth > max_depth)
524 qdepth = max_depth; 524 qdepth = max_depth;
525 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); 525 scsi_adjust_queue_depth(sdev, qdepth);
526 526
527 if (sdev->inquiry_len > 7) 527 if (sdev->inquiry_len > 7)
528 sdev_printk(KERN_INFO, sdev, 528 sdev_printk(KERN_INFO, sdev,
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 120a851df0d7..0ed96644ec94 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -121,13 +121,13 @@ static int tcm_loop_change_queue_depth(
121{ 121{
122 switch (reason) { 122 switch (reason) {
123 case SCSI_QDEPTH_DEFAULT: 123 case SCSI_QDEPTH_DEFAULT:
124 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); 124 scsi_adjust_queue_depth(sdev, depth);
125 break; 125 break;
126 case SCSI_QDEPTH_QFULL: 126 case SCSI_QDEPTH_QFULL:
127 scsi_track_queue_full(sdev, depth); 127 scsi_track_queue_full(sdev, depth);
128 break; 128 break;
129 case SCSI_QDEPTH_RAMP_UP: 129 case SCSI_QDEPTH_RAMP_UP:
130 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); 130 scsi_adjust_queue_depth(sdev, depth);
131 break; 131 break;
132 default: 132 default:
133 return -EOPNOTSUPP; 133 return -EOPNOTSUPP;
@@ -404,19 +404,6 @@ static int tcm_loop_slave_alloc(struct scsi_device *sd)
404 return 0; 404 return 0;
405} 405}
406 406
407static int tcm_loop_slave_configure(struct scsi_device *sd)
408{
409 if (sd->tagged_supported) {
410 scsi_adjust_queue_depth(sd, MSG_SIMPLE_TAG,
411 sd->host->cmd_per_lun);
412 } else {
413 scsi_adjust_queue_depth(sd, 0,
414 sd->host->cmd_per_lun);
415 }
416
417 return 0;
418}
419
420static struct scsi_host_template tcm_loop_driver_template = { 407static struct scsi_host_template tcm_loop_driver_template = {
421 .show_info = tcm_loop_show_info, 408 .show_info = tcm_loop_show_info,
422 .proc_name = "tcm_loopback", 409 .proc_name = "tcm_loopback",
@@ -434,7 +421,6 @@ static struct scsi_host_template tcm_loop_driver_template = {
434 .max_sectors = 0xFFFF, 421 .max_sectors = 0xFFFF,
435 .use_clustering = DISABLE_CLUSTERING, 422 .use_clustering = DISABLE_CLUSTERING,
436 .slave_alloc = tcm_loop_slave_alloc, 423 .slave_alloc = tcm_loop_slave_alloc,
437 .slave_configure = tcm_loop_slave_configure,
438 .module = THIS_MODULE, 424 .module = THIS_MODULE,
439 .use_blk_tags = 1, 425 .use_blk_tags = 1,
440}; 426};
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index ee69b82fc7d1..33f211b56a42 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -799,7 +799,7 @@ static int uas_slave_configure(struct scsi_device *sdev)
799 if (devinfo->flags & US_FL_NO_REPORT_OPCODES) 799 if (devinfo->flags & US_FL_NO_REPORT_OPCODES)
800 sdev->no_report_opcodes = 1; 800 sdev->no_report_opcodes = 1;
801 801
802 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, devinfo->qdepth - 2); 802 scsi_adjust_queue_depth(sdev, devinfo->qdepth - 2);
803 return 0; 803 return 0;
804} 804}
805 805