summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/libata-scsi.c3
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c5
-rw-r--r--drivers/message/fusion/mptsas.c1
-rw-r--r--drivers/scsi/53c700.c11
-rw-r--r--drivers/scsi/advansys.c6
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c1
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c1
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c1
-rw-r--r--drivers/scsi/bfa/bfad_im.c2
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c1
-rw-r--r--drivers/scsi/csiostor/csio_scsi.c2
-rw-r--r--drivers/scsi/esas2r/esas2r_main.c1
-rw-r--r--drivers/scsi/esp_scsi.c1
-rw-r--r--drivers/scsi/fcoe/fcoe.c1
-rw-r--r--drivers/scsi/fnic/fnic_main.c8
-rw-r--r--drivers/scsi/hosts.c7
-rw-r--r--drivers/scsi/hpsa.c10
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c1
-rw-r--r--drivers/scsi/ipr.c1
-rw-r--r--drivers/scsi/isci/init.c1
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c3
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c8
-rw-r--r--drivers/scsi/mvsas/mv_init.c1
-rw-r--r--drivers/scsi/pm8001/pm8001_init.c1
-rw-r--r--drivers/scsi/pmcraid.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c1
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c8
-rw-r--r--drivers/scsi/scsi.c27
-rw-r--r--drivers/scsi/scsi_scan.c3
-rw-r--r--drivers/scsi/snic/snic_main.c10
-rw-r--r--drivers/scsi/stex.c8
-rw-r--r--drivers/scsi/ufs/ufshcd.c8
-rw-r--r--drivers/target/loopback/tcm_loop.c1
-rw-r--r--drivers/usb/storage/uas.c5
-rw-r--r--include/scsi/scsi_host.h5
-rw-r--r--include/scsi/scsi_tcq.h95
36 files changed, 39 insertions, 211 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 0d7f0da3a269..ade388648fe7 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3689,9 +3689,6 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
3689 */ 3689 */
3690 shost->max_host_blocked = 1; 3690 shost->max_host_blocked = 1;
3691 3691
3692 if (scsi_init_shared_tag_map(shost, host->n_tags))
3693 goto err_add;
3694
3695 rc = scsi_add_host_with_dma(ap->scsi_host, 3692 rc = scsi_add_host_with_dma(ap->scsi_host,
3696 &ap->tdev, ap->host->dev); 3693 &ap->tdev, ap->host->dev);
3697 if (rc) 3694 if (rc)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index b481490ad257..96014dc4b6dd 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2750,7 +2750,6 @@ static struct scsi_host_template srp_template = {
2750 .cmd_per_lun = SRP_DEFAULT_CMD_SQ_SIZE, 2750 .cmd_per_lun = SRP_DEFAULT_CMD_SQ_SIZE,
2751 .use_clustering = ENABLE_CLUSTERING, 2751 .use_clustering = ENABLE_CLUSTERING,
2752 .shost_attrs = srp_host_attrs, 2752 .shost_attrs = srp_host_attrs,
2753 .use_blk_tags = 1,
2754 .track_queue_depth = 1, 2753 .track_queue_depth = 1,
2755}; 2754};
2756 2755
@@ -3181,10 +3180,6 @@ static ssize_t srp_create_target(struct device *dev,
3181 if (ret) 3180 if (ret)
3182 goto out; 3181 goto out;
3183 3182
3184 ret = scsi_init_shared_tag_map(target_host, target_host->can_queue);
3185 if (ret)
3186 goto out;
3187
3188 target->req_ring_size = target->queue_size - SRP_TSK_MGMT_SQ_SIZE; 3183 target->req_ring_size = target->queue_size - SRP_TSK_MGMT_SQ_SIZE;
3189 3184
3190 if (!srp_conn_unique(target->srp_host, target)) { 3185 if (!srp_conn_unique(target->srp_host, target)) {
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 005a88b9f440..7ebccfa8072a 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1994,7 +1994,6 @@ static struct scsi_host_template mptsas_driver_template = {
1994 .cmd_per_lun = 7, 1994 .cmd_per_lun = 7,
1995 .use_clustering = ENABLE_CLUSTERING, 1995 .use_clustering = ENABLE_CLUSTERING,
1996 .shost_attrs = mptscsih_host_attrs, 1996 .shost_attrs = mptscsih_host_attrs,
1997 .use_blk_tags = 1,
1998}; 1997};
1999 1998
2000static int mptsas_get_linkerrors(struct sas_phy *phy) 1999static int mptsas_get_linkerrors(struct sas_phy *phy)
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index a209c3418898..d4c285688ce9 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -325,7 +325,6 @@ NCR_700_detect(struct scsi_host_template *tpnt,
325 tpnt->slave_destroy = NCR_700_slave_destroy; 325 tpnt->slave_destroy = NCR_700_slave_destroy;
326 tpnt->slave_alloc = NCR_700_slave_alloc; 326 tpnt->slave_alloc = NCR_700_slave_alloc;
327 tpnt->change_queue_depth = NCR_700_change_queue_depth; 327 tpnt->change_queue_depth = NCR_700_change_queue_depth;
328 tpnt->use_blk_tags = 1;
329 328
330 if(tpnt->name == NULL) 329 if(tpnt->name == NULL)
331 tpnt->name = "53c700"; 330 tpnt->name = "53c700";
@@ -1107,7 +1106,9 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
1107 BUG(); 1106 BUG();
1108 } 1107 }
1109 if(hostdata->msgin[1] == A_SIMPLE_TAG_MSG) { 1108 if(hostdata->msgin[1] == A_SIMPLE_TAG_MSG) {
1110 struct scsi_cmnd *SCp = scsi_find_tag(SDp, hostdata->msgin[2]); 1109 struct scsi_cmnd *SCp;
1110
1111 SCp = scsi_host_find_tag(SDp->host, hostdata->msgin[2]);
1111 if(unlikely(SCp == NULL)) { 1112 if(unlikely(SCp == NULL)) {
1112 printk(KERN_ERR "scsi%d: (%d:%d) no saved request for tag %d\n", 1113 printk(KERN_ERR "scsi%d: (%d:%d) no saved request for tag %d\n",
1113 host->host_no, reselection_id, lun, hostdata->msgin[2]); 1114 host->host_no, reselection_id, lun, hostdata->msgin[2]);
@@ -1119,7 +1120,9 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
1119 "reselection is tag %d, slot %p(%d)\n", 1120 "reselection is tag %d, slot %p(%d)\n",
1120 hostdata->msgin[2], slot, slot->tag); 1121 hostdata->msgin[2], slot, slot->tag);
1121 } else { 1122 } else {
1122 struct scsi_cmnd *SCp = scsi_find_tag(SDp, SCSI_NO_TAG); 1123 struct scsi_cmnd *SCp;
1124
1125 SCp = scsi_host_find_tag(SDp->host, SCSI_NO_TAG);
1123 if(unlikely(SCp == NULL)) { 1126 if(unlikely(SCp == NULL)) {
1124 sdev_printk(KERN_ERR, SDp, 1127 sdev_printk(KERN_ERR, SDp,
1125 "no saved request for untagged cmd\n"); 1128 "no saved request for untagged cmd\n");
@@ -1823,7 +1826,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
1823 slot->tag, slot); 1826 slot->tag, slot);
1824 } else { 1827 } else {
1825 slot->tag = SCSI_NO_TAG; 1828 slot->tag = SCSI_NO_TAG;
1826 /* must populate current_cmnd for scsi_find_tag to work */ 1829 /* must populate current_cmnd for scsi_host_find_tag to work */
1827 SCp->device->current_cmnd = SCp; 1830 SCp->device->current_cmnd = SCp;
1828 } 1831 }
1829 /* sanity check: some of the commands generated by the mid-layer 1832 /* sanity check: some of the commands generated by the mid-layer
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 4305178e4e01..519f9a4b3dad 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -10819,7 +10819,6 @@ static struct scsi_host_template advansys_template = {
10819 * by enabling clustering, I/O throughput increases as well. 10819 * by enabling clustering, I/O throughput increases as well.
10820 */ 10820 */
10821 .use_clustering = ENABLE_CLUSTERING, 10821 .use_clustering = ENABLE_CLUSTERING,
10822 .use_blk_tags = 1,
10823}; 10822};
10824 10823
10825static int advansys_wide_init_chip(struct Scsi_Host *shost) 10824static int advansys_wide_init_chip(struct Scsi_Host *shost)
@@ -11211,11 +11210,6 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop,
11211 /* Set maximum number of queues the adapter can handle. */ 11210 /* Set maximum number of queues the adapter can handle. */
11212 shost->can_queue = adv_dvc_varp->max_host_qng; 11211 shost->can_queue = adv_dvc_varp->max_host_qng;
11213 } 11212 }
11214 ret = scsi_init_shared_tag_map(shost, shost->can_queue);
11215 if (ret) {
11216 shost_printk(KERN_ERR, shost, "init tag map failed\n");
11217 goto err_free_dma;
11218 }
11219 11213
11220 /* 11214 /*
11221 * Set the maximum number of scatter-gather elements the 11215 * Set the maximum number of scatter-gather elements the
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index ce96a0be3282..2588b8f84ba0 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -925,7 +925,6 @@ struct scsi_host_template aic79xx_driver_template = {
925 .slave_configure = ahd_linux_slave_configure, 925 .slave_configure = ahd_linux_slave_configure,
926 .target_alloc = ahd_linux_target_alloc, 926 .target_alloc = ahd_linux_target_alloc,
927 .target_destroy = ahd_linux_target_destroy, 927 .target_destroy = ahd_linux_target_destroy,
928 .use_blk_tags = 1,
929}; 928};
930 929
931/******************************** Bus DMA *************************************/ 930/******************************** Bus DMA *************************************/
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index a2f2c774cd6b..b846a4683562 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -812,7 +812,6 @@ struct scsi_host_template aic7xxx_driver_template = {
812 .slave_configure = ahc_linux_slave_configure, 812 .slave_configure = ahc_linux_slave_configure,
813 .target_alloc = ahc_linux_target_alloc, 813 .target_alloc = ahc_linux_target_alloc,
814 .target_destroy = ahc_linux_target_destroy, 814 .target_destroy = ahc_linux_target_destroy,
815 .use_blk_tags = 1,
816}; 815};
817 816
818/**************************** Tasklet Handler *********************************/ 817/**************************** Tasklet Handler *********************************/
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index f6c336b05d5b..cd094bf82a77 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -73,7 +73,6 @@ static struct scsi_host_template aic94xx_sht = {
73 .eh_bus_reset_handler = sas_eh_bus_reset_handler, 73 .eh_bus_reset_handler = sas_eh_bus_reset_handler,
74 .target_destroy = sas_target_destroy, 74 .target_destroy = sas_target_destroy,
75 .ioctl = sas_ioctl, 75 .ioctl = sas_ioctl,
76 .use_blk_tags = 1,
77 .track_queue_depth = 1, 76 .track_queue_depth = 1,
78}; 77};
79 78
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 8367c11d554b..299c6f80d460 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -800,7 +800,6 @@ struct scsi_host_template bfad_im_scsi_host_template = {
800 .shost_attrs = bfad_im_host_attrs, 800 .shost_attrs = bfad_im_host_attrs,
801 .max_sectors = BFAD_MAX_SECTORS, 801 .max_sectors = BFAD_MAX_SECTORS,
802 .vendor_id = BFA_PCI_VENDOR_ID_BROCADE, 802 .vendor_id = BFA_PCI_VENDOR_ID_BROCADE,
803 .use_blk_tags = 1,
804}; 803};
805 804
806struct scsi_host_template bfad_im_vport_template = { 805struct scsi_host_template bfad_im_vport_template = {
@@ -822,7 +821,6 @@ struct scsi_host_template bfad_im_vport_template = {
822 .use_clustering = ENABLE_CLUSTERING, 821 .use_clustering = ENABLE_CLUSTERING,
823 .shost_attrs = bfad_im_vport_attrs, 822 .shost_attrs = bfad_im_vport_attrs,
824 .max_sectors = BFAD_MAX_SECTORS, 823 .max_sectors = BFAD_MAX_SECTORS,
825 .use_blk_tags = 1,
826}; 824};
827 825
828bfa_status_t 826bfa_status_t
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 29a1c03b558e..0857d80f2999 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -2867,7 +2867,6 @@ static struct scsi_host_template bnx2fc_shost_template = {
2867 .use_clustering = ENABLE_CLUSTERING, 2867 .use_clustering = ENABLE_CLUSTERING,
2868 .sg_tablesize = BNX2FC_MAX_BDS_PER_CMD, 2868 .sg_tablesize = BNX2FC_MAX_BDS_PER_CMD,
2869 .max_sectors = 1024, 2869 .max_sectors = 1024,
2870 .use_blk_tags = 1,
2871 .track_queue_depth = 1, 2870 .track_queue_depth = 1,
2872}; 2871};
2873 2872
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 2c4562d82dc0..c2a6f9f29427 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -2283,7 +2283,6 @@ struct scsi_host_template csio_fcoe_shost_template = {
2283 .use_clustering = ENABLE_CLUSTERING, 2283 .use_clustering = ENABLE_CLUSTERING,
2284 .shost_attrs = csio_fcoe_lport_attrs, 2284 .shost_attrs = csio_fcoe_lport_attrs,
2285 .max_sectors = CSIO_MAX_SECTOR_SIZE, 2285 .max_sectors = CSIO_MAX_SECTOR_SIZE,
2286 .use_blk_tags = 1,
2287}; 2286};
2288 2287
2289struct scsi_host_template csio_fcoe_shost_vport_template = { 2288struct scsi_host_template csio_fcoe_shost_vport_template = {
@@ -2303,7 +2302,6 @@ struct scsi_host_template csio_fcoe_shost_vport_template = {
2303 .use_clustering = ENABLE_CLUSTERING, 2302 .use_clustering = ENABLE_CLUSTERING,
2304 .shost_attrs = csio_fcoe_vport_attrs, 2303 .shost_attrs = csio_fcoe_vport_attrs,
2305 .max_sectors = CSIO_MAX_SECTOR_SIZE, 2304 .max_sectors = CSIO_MAX_SECTOR_SIZE,
2306 .use_blk_tags = 1,
2307}; 2305};
2308 2306
2309/* 2307/*
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index 31f8966b2e03..33581ba4386e 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -256,7 +256,6 @@ static struct scsi_host_template driver_template = {
256 .proc_name = ESAS2R_DRVR_NAME, 256 .proc_name = ESAS2R_DRVR_NAME,
257 .change_queue_depth = scsi_change_queue_depth, 257 .change_queue_depth = scsi_change_queue_depth,
258 .max_sectors = 0xFFFF, 258 .max_sectors = 0xFFFF,
259 .use_blk_tags = 1,
260}; 259};
261 260
262int sgl_page_size = 512; 261int sgl_page_size = 512;
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 065b25df741b..71cb05b1c3eb 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2694,7 +2694,6 @@ struct scsi_host_template scsi_esp_template = {
2694 .use_clustering = ENABLE_CLUSTERING, 2694 .use_clustering = ENABLE_CLUSTERING,
2695 .max_sectors = 0xffff, 2695 .max_sectors = 0xffff,
2696 .skip_settle_delay = 1, 2696 .skip_settle_delay = 1,
2697 .use_blk_tags = 1,
2698}; 2697};
2699EXPORT_SYMBOL(scsi_esp_template); 2698EXPORT_SYMBOL(scsi_esp_template);
2700 2699
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index d187ba9b361d..f4424063b860 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -287,7 +287,6 @@ static struct scsi_host_template fcoe_shost_template = {
287 .use_clustering = ENABLE_CLUSTERING, 287 .use_clustering = ENABLE_CLUSTERING,
288 .sg_tablesize = SG_ALL, 288 .sg_tablesize = SG_ALL,
289 .max_sectors = 0xffff, 289 .max_sectors = 0xffff,
290 .use_blk_tags = 1,
291 .track_queue_depth = 1, 290 .track_queue_depth = 1,
292}; 291};
293 292
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 8a0d4d7b3254..58ce9020d69c 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -118,7 +118,6 @@ static struct scsi_host_template fnic_host_template = {
118 .sg_tablesize = FNIC_MAX_SG_DESC_CNT, 118 .sg_tablesize = FNIC_MAX_SG_DESC_CNT,
119 .max_sectors = 0xffff, 119 .max_sectors = 0xffff,
120 .shost_attrs = fnic_attrs, 120 .shost_attrs = fnic_attrs,
121 .use_blk_tags = 1,
122 .track_queue_depth = 1, 121 .track_queue_depth = 1,
123}; 122};
124 123
@@ -697,13 +696,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
697 } 696 }
698 fnic->fnic_max_tag_id = host->can_queue; 697 fnic->fnic_max_tag_id = host->can_queue;
699 698
700 err = scsi_init_shared_tag_map(host, fnic->fnic_max_tag_id);
701 if (err) {
702 shost_printk(KERN_ERR, fnic->lport->host,
703 "Unable to alloc shared tag map\n");
704 goto err_out_dev_close;
705 }
706
707 host->max_lun = fnic->config.luns_per_tgt; 699 host->max_lun = fnic->config.luns_per_tgt;
708 host->max_id = FNIC_MAX_FCP_TARGET; 700 host->max_id = FNIC_MAX_FCP_TARGET;
709 host->max_cmd_len = FCOE_MAX_CMD_LEN; 701 host->max_cmd_len = FCOE_MAX_CMD_LEN;
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 8bb173e01084..323982fd00c3 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -217,6 +217,13 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
217 error = scsi_mq_setup_tags(shost); 217 error = scsi_mq_setup_tags(shost);
218 if (error) 218 if (error)
219 goto fail; 219 goto fail;
220 } else {
221 shost->bqt = blk_init_tags(shost->can_queue,
222 shost->hostt->tag_alloc_policy);
223 if (!shost->bqt) {
224 error = -ENOMEM;
225 goto fail;
226 }
220 } 227 }
221 228
222 /* 229 /*
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 40669f8dd0df..7506b65d8e6c 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4983,7 +4983,6 @@ static int hpsa_scan_finished(struct Scsi_Host *sh,
4983static int hpsa_scsi_host_alloc(struct ctlr_info *h) 4983static int hpsa_scsi_host_alloc(struct ctlr_info *h)
4984{ 4984{
4985 struct Scsi_Host *sh; 4985 struct Scsi_Host *sh;
4986 int error;
4987 4986
4988 sh = scsi_host_alloc(&hpsa_driver_template, sizeof(h)); 4987 sh = scsi_host_alloc(&hpsa_driver_template, sizeof(h));
4989 if (sh == NULL) { 4988 if (sh == NULL) {
@@ -5004,14 +5003,7 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h)
5004 sh->hostdata[0] = (unsigned long) h; 5003 sh->hostdata[0] = (unsigned long) h;
5005 sh->irq = h->intr[h->intr_mode]; 5004 sh->irq = h->intr[h->intr_mode];
5006 sh->unique_id = sh->irq; 5005 sh->unique_id = sh->irq;
5007 error = scsi_init_shared_tag_map(sh, sh->can_queue); 5006
5008 if (error) {
5009 dev_err(&h->pdev->dev,
5010 "%s: scsi_init_shared_tag_map failed for controller %d\n",
5011 __func__, h->ctlr);
5012 scsi_host_put(sh);
5013 return error;
5014 }
5015 h->scsi_host = sh; 5007 h->scsi_host = sh;
5016 return 0; 5008 return 0;
5017} 5009}
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 057d27721d5b..6aa317c303e2 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -3095,7 +3095,6 @@ static struct scsi_host_template driver_template = {
3095 .max_sectors = IBMVFC_MAX_SECTORS, 3095 .max_sectors = IBMVFC_MAX_SECTORS,
3096 .use_clustering = ENABLE_CLUSTERING, 3096 .use_clustering = ENABLE_CLUSTERING,
3097 .shost_attrs = ibmvfc_attrs, 3097 .shost_attrs = ibmvfc_attrs,
3098 .use_blk_tags = 1,
3099 .track_queue_depth = 1, 3098 .track_queue_depth = 1,
3100}; 3099};
3101 3100
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index b62836ddbbee..4f2c16778efa 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -6502,7 +6502,6 @@ static struct scsi_host_template driver_template = {
6502 .shost_attrs = ipr_ioa_attrs, 6502 .shost_attrs = ipr_ioa_attrs,
6503 .sdev_attrs = ipr_dev_attrs, 6503 .sdev_attrs = ipr_dev_attrs,
6504 .proc_name = IPR_NAME, 6504 .proc_name = IPR_NAME,
6505 .use_blk_tags = 1,
6506}; 6505};
6507 6506
6508/** 6507/**
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 0dfcabe3ca7c..2f973df72d9b 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -170,7 +170,6 @@ static struct scsi_host_template isci_sht = {
170 .target_destroy = sas_target_destroy, 170 .target_destroy = sas_target_destroy,
171 .ioctl = sas_ioctl, 171 .ioctl = sas_ioctl,
172 .shost_attrs = isci_host_attrs, 172 .shost_attrs = isci_host_attrs,
173 .use_blk_tags = 1,
174 .track_queue_depth = 1, 173 .track_queue_depth = 1,
175}; 174};
176 175
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 051b3b3bd625..4679ed4444a7 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -5914,7 +5914,6 @@ struct scsi_host_template lpfc_template_s3 = {
5914 .max_sectors = 0xFFFF, 5914 .max_sectors = 0xFFFF,
5915 .vendor_id = LPFC_NL_VENDOR_ID, 5915 .vendor_id = LPFC_NL_VENDOR_ID,
5916 .change_queue_depth = scsi_change_queue_depth, 5916 .change_queue_depth = scsi_change_queue_depth,
5917 .use_blk_tags = 1,
5918 .track_queue_depth = 1, 5917 .track_queue_depth = 1,
5919}; 5918};
5920 5919
@@ -5940,7 +5939,6 @@ struct scsi_host_template lpfc_template = {
5940 .max_sectors = 0xFFFF, 5939 .max_sectors = 0xFFFF,
5941 .vendor_id = LPFC_NL_VENDOR_ID, 5940 .vendor_id = LPFC_NL_VENDOR_ID,
5942 .change_queue_depth = scsi_change_queue_depth, 5941 .change_queue_depth = scsi_change_queue_depth,
5943 .use_blk_tags = 1,
5944 .track_queue_depth = 1, 5942 .track_queue_depth = 1,
5945}; 5943};
5946 5944
@@ -5964,6 +5962,5 @@ struct scsi_host_template lpfc_vport_template = {
5964 .shost_attrs = lpfc_vport_attrs, 5962 .shost_attrs = lpfc_vport_attrs,
5965 .max_sectors = 0xFFFF, 5963 .max_sectors = 0xFFFF,
5966 .change_queue_depth = scsi_change_queue_depth, 5964 .change_queue_depth = scsi_change_queue_depth,
5967 .use_blk_tags = 1,
5968 .track_queue_depth = 1, 5965 .track_queue_depth = 1,
5969}; 5966};
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index eaa81e552fd2..3b3f4809331b 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5049,7 +5049,6 @@ static int megasas_start_aen(struct megasas_instance *instance)
5049static int megasas_io_attach(struct megasas_instance *instance) 5049static int megasas_io_attach(struct megasas_instance *instance)
5050{ 5050{
5051 struct Scsi_Host *host = instance->host; 5051 struct Scsi_Host *host = instance->host;
5052 u32 error;
5053 5052
5054 /* 5053 /*
5055 * Export parameters required by SCSI mid-layer 5054 * Export parameters required by SCSI mid-layer
@@ -5099,13 +5098,6 @@ static int megasas_io_attach(struct megasas_instance *instance)
5099 host->hostt->eh_device_reset_handler = NULL; 5098 host->hostt->eh_device_reset_handler = NULL;
5100 host->hostt->eh_bus_reset_handler = NULL; 5099 host->hostt->eh_bus_reset_handler = NULL;
5101 } 5100 }
5102 error = scsi_init_shared_tag_map(host, host->can_queue);
5103 if (error) {
5104 dev_err(&instance->pdev->dev,
5105 "Failed to shared tag from %s %d\n",
5106 __func__, __LINE__);
5107 return -ENODEV;
5108 }
5109 5101
5110 /* 5102 /*
5111 * Notify the mid-layer about the new controller 5103 * Notify the mid-layer about the new controller
diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index e2d555c1bffc..221d25e9dc5f 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -65,7 +65,6 @@ static struct scsi_host_template mvs_sht = {
65 .target_destroy = sas_target_destroy, 65 .target_destroy = sas_target_destroy,
66 .ioctl = sas_ioctl, 66 .ioctl = sas_ioctl,
67 .shost_attrs = mvst_host_attrs, 67 .shost_attrs = mvst_host_attrs,
68 .use_blk_tags = 1,
69 .track_queue_depth = 1, 68 .track_queue_depth = 1,
70}; 69};
71 70
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 5c0356fb6310..e64b8bfafd80 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -88,7 +88,6 @@ static struct scsi_host_template pm8001_sht = {
88 .target_destroy = sas_target_destroy, 88 .target_destroy = sas_target_destroy,
89 .ioctl = sas_ioctl, 89 .ioctl = sas_ioctl,
90 .shost_attrs = pm8001_host_attrs, 90 .shost_attrs = pm8001_host_attrs,
91 .use_blk_tags = 1,
92 .track_queue_depth = 1, 91 .track_queue_depth = 1,
93}; 92};
94 93
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index ed31d8cc6266..48d62249c226 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4254,7 +4254,6 @@ static struct scsi_host_template pmcraid_host_template = {
4254 .use_clustering = ENABLE_CLUSTERING, 4254 .use_clustering = ENABLE_CLUSTERING,
4255 .shost_attrs = pmcraid_host_attrs, 4255 .shost_attrs = pmcraid_host_attrs,
4256 .proc_name = PMCRAID_DRIVER_NAME, 4256 .proc_name = PMCRAID_DRIVER_NAME,
4257 .use_blk_tags = 1,
4258}; 4257};
4259 4258
4260/* 4259/*
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index c2dd17b1d26f..bfa9a64c316b 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -267,7 +267,6 @@ struct scsi_host_template qla2xxx_driver_template = {
267 .shost_attrs = qla2x00_host_attrs, 267 .shost_attrs = qla2x00_host_attrs,
268 268
269 .supported_mode = MODE_INITIATOR, 269 .supported_mode = MODE_INITIATOR,
270 .use_blk_tags = 1,
271 .track_queue_depth = 1, 270 .track_queue_depth = 1,
272}; 271};
273 272
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 6d25879d87c8..01c3610a60cf 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -212,7 +212,6 @@ static struct scsi_host_template qla4xxx_driver_template = {
212 .shost_attrs = qla4xxx_host_attrs, 212 .shost_attrs = qla4xxx_host_attrs,
213 .host_reset = qla4xxx_host_reset, 213 .host_reset = qla4xxx_host_reset,
214 .vendor_id = SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC, 214 .vendor_id = SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC,
215 .use_blk_tags = 1,
216}; 215};
217 216
218static struct iscsi_transport qla4xxx_iscsi_transport = { 217static struct iscsi_transport qla4xxx_iscsi_transport = {
@@ -8697,13 +8696,6 @@ static int qla4xxx_probe_adapter(struct pci_dev *pdev,
8697 host->can_queue = MAX_SRBS ; 8696 host->can_queue = MAX_SRBS ;
8698 host->transportt = qla4xxx_scsi_transport; 8697 host->transportt = qla4xxx_scsi_transport;
8699 8698
8700 ret = scsi_init_shared_tag_map(host, MAX_SRBS);
8701 if (ret) {
8702 ql4_printk(KERN_WARNING, ha,
8703 "%s: scsi_init_shared_tag_map failed\n", __func__);
8704 goto probe_failed;
8705 }
8706
8707 pci_set_drvdata(pdev, ha); 8699 pci_set_drvdata(pdev, ha);
8708 8700
8709 ret = scsi_add_host(host, &pdev->dev); 8701 ret = scsi_add_host(host, &pdev->dev);
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 207d6a7a1bd0..d07fb653f5dc 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -616,32 +616,11 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
616 */ 616 */
617int scsi_change_queue_depth(struct scsi_device *sdev, int depth) 617int scsi_change_queue_depth(struct scsi_device *sdev, int depth)
618{ 618{
619 unsigned long flags; 619 if (depth > 0) {
620 620 sdev->queue_depth = depth;
621 if (depth <= 0) 621 wmb();
622 goto out;
623
624 spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
625
626 /*
627 * Check to see if the queue is managed by the block layer.
628 * If it is, and we fail to adjust the depth, exit.
629 *
630 * Do not resize the tag map if it is a host wide share bqt,
631 * because the size should be the hosts's can_queue. If there
632 * is more IO than the LLD's can_queue (so there are not enuogh
633 * tags) request_fn's host queue ready check will handle it.
634 */
635 if (!shost_use_blk_mq(sdev->host) && !sdev->host->bqt) {
636 if (blk_queue_tagged(sdev->request_queue) &&
637 blk_queue_resize_tags(sdev->request_queue, depth) != 0)
638 goto out_unlock;
639 } 622 }
640 623
641 sdev->queue_depth = depth;
642out_unlock:
643 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
644out:
645 return sdev->queue_depth; 624 return sdev->queue_depth;
646} 625}
647EXPORT_SYMBOL(scsi_change_queue_depth); 626EXPORT_SYMBOL(scsi_change_queue_depth);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index f9f3f8203d42..998f3788d8e9 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -274,8 +274,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
274 WARN_ON_ONCE(!blk_get_queue(sdev->request_queue)); 274 WARN_ON_ONCE(!blk_get_queue(sdev->request_queue));
275 sdev->request_queue->queuedata = sdev; 275 sdev->request_queue->queuedata = sdev;
276 276
277 if (!shost_use_blk_mq(sdev->host) && 277 if (!shost_use_blk_mq(sdev->host)) {
278 (shost->bqt || shost->hostt->use_blk_tags)) {
279 blk_queue_init_tags(sdev->request_queue, 278 blk_queue_init_tags(sdev->request_queue,
280 sdev->host->cmd_per_lun, shost->bqt, 279 sdev->host->cmd_per_lun, shost->bqt,
281 shost->hostt->tag_alloc_policy); 280 shost->hostt->tag_alloc_policy);
diff --git a/drivers/scsi/snic/snic_main.c b/drivers/scsi/snic/snic_main.c
index b2b87cef00fc..2b3c25371d76 100644
--- a/drivers/scsi/snic/snic_main.c
+++ b/drivers/scsi/snic/snic_main.c
@@ -124,7 +124,6 @@ static struct scsi_host_template snic_host_template = {
124 .sg_tablesize = SNIC_MAX_SG_DESC_CNT, 124 .sg_tablesize = SNIC_MAX_SG_DESC_CNT,
125 .max_sectors = 0x800, 125 .max_sectors = 0x800,
126 .shost_attrs = snic_attrs, 126 .shost_attrs = snic_attrs,
127 .use_blk_tags = 1,
128 .track_queue_depth = 1, 127 .track_queue_depth = 1,
129 .cmd_size = sizeof(struct snic_internal_io_state), 128 .cmd_size = sizeof(struct snic_internal_io_state),
130 .proc_name = "snic_scsi", 129 .proc_name = "snic_scsi",
@@ -533,15 +532,6 @@ snic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
533 532
534 snic->max_tag_id = shost->can_queue; 533 snic->max_tag_id = shost->can_queue;
535 534
536 ret = scsi_init_shared_tag_map(shost, snic->max_tag_id);
537 if (ret) {
538 SNIC_HOST_ERR(shost,
539 "Unable to alloc shared tag map. %d\n",
540 ret);
541
542 goto err_dev_close;
543 }
544
545 shost->max_lun = snic->config.luns_per_tgt; 535 shost->max_lun = snic->config.luns_per_tgt;
546 shost->max_id = SNIC_MAX_TARGET; 536 shost->max_id = SNIC_MAX_TARGET;
547 537
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 98a62bc15069..56353cd9abd3 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -1374,7 +1374,6 @@ static struct scsi_host_template driver_template = {
1374 .eh_abort_handler = stex_abort, 1374 .eh_abort_handler = stex_abort,
1375 .eh_host_reset_handler = stex_reset, 1375 .eh_host_reset_handler = stex_reset,
1376 .this_id = -1, 1376 .this_id = -1,
1377 .use_blk_tags = 1,
1378}; 1377};
1379 1378
1380static struct pci_device_id stex_pci_tbl[] = { 1379static struct pci_device_id stex_pci_tbl[] = {
@@ -1659,13 +1658,6 @@ static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1659 if (err) 1658 if (err)
1660 goto out_free_irq; 1659 goto out_free_irq;
1661 1660
1662 err = scsi_init_shared_tag_map(host, host->can_queue);
1663 if (err) {
1664 printk(KERN_ERR DRV_NAME "(%s): init shared queue failed\n",
1665 pci_name(pdev));
1666 goto out_free_irq;
1667 }
1668
1669 pci_set_drvdata(pdev, hba); 1661 pci_set_drvdata(pdev, hba);
1670 1662
1671 err = scsi_add_host(host, &pdev->dev); 1663 err = scsi_add_host(host, &pdev->dev);
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index b0ade73f8c6a..9065eb451677 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4355,7 +4355,6 @@ static struct scsi_host_template ufshcd_driver_template = {
4355 .cmd_per_lun = UFSHCD_CMD_PER_LUN, 4355 .cmd_per_lun = UFSHCD_CMD_PER_LUN,
4356 .can_queue = UFSHCD_CAN_QUEUE, 4356 .can_queue = UFSHCD_CAN_QUEUE,
4357 .max_host_blocked = 1, 4357 .max_host_blocked = 1,
4358 .use_blk_tags = 1,
4359 .track_queue_depth = 1, 4358 .track_queue_depth = 1,
4360}; 4359};
4361 4360
@@ -5619,13 +5618,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
5619 hba->is_irq_enabled = true; 5618 hba->is_irq_enabled = true;
5620 } 5619 }
5621 5620
5622 /* Enable SCSI tag mapping */
5623 err = scsi_init_shared_tag_map(host, host->can_queue);
5624 if (err) {
5625 dev_err(hba->dev, "init shared queue failed\n");
5626 goto exit_gating;
5627 }
5628
5629 err = scsi_add_host(host, hba->dev); 5621 err = scsi_add_host(host, hba->dev);
5630 if (err) { 5622 if (err) {
5631 dev_err(hba->dev, "scsi_add_host failed\n"); 5623 dev_err(hba->dev, "scsi_add_host failed\n");
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 5bc85ffed720..081f1cfefeb3 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -377,7 +377,6 @@ static struct scsi_host_template tcm_loop_driver_template = {
377 .use_clustering = DISABLE_CLUSTERING, 377 .use_clustering = DISABLE_CLUSTERING,
378 .slave_alloc = tcm_loop_slave_alloc, 378 .slave_alloc = tcm_loop_slave_alloc,
379 .module = THIS_MODULE, 379 .module = THIS_MODULE,
380 .use_blk_tags = 1,
381 .track_queue_depth = 1, 380 .track_queue_depth = 1,
382}; 381};
383 382
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index f68921909552..2850663f5126 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -812,7 +812,6 @@ static struct scsi_host_template uas_host_template = {
812 .this_id = -1, 812 .this_id = -1,
813 .sg_tablesize = SG_NONE, 813 .sg_tablesize = SG_NONE,
814 .skip_settle_delay = 1, 814 .skip_settle_delay = 1,
815 .use_blk_tags = 1,
816}; 815};
817 816
818#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ 817#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
@@ -929,10 +928,6 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
929 if (result) 928 if (result)
930 goto set_alt0; 929 goto set_alt0;
931 930
932 result = scsi_init_shared_tag_map(shost, devinfo->qdepth - 2);
933 if (result)
934 goto free_streams;
935
936 usb_set_intfdata(intf, shost); 931 usb_set_intfdata(intf, shost);
937 result = scsi_add_host(shost, &intf->dev); 932 result = scsi_add_host(shost, &intf->dev);
938 if (result) 933 if (result)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index e113c757d555..ed527121031d 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -406,11 +406,6 @@ struct scsi_host_template {
406 int tag_alloc_policy; 406 int tag_alloc_policy;
407 407
408 /* 408 /*
409 * Let the block layer assigns tags to all commands.
410 */
411 unsigned use_blk_tags:1;
412
413 /*
414 * Track QUEUE_FULL events and reduce queue depth on demand. 409 * Track QUEUE_FULL events and reduce queue depth on demand.
415 */ 410 */
416 unsigned track_queue_depth:1; 411 unsigned track_queue_depth:1;
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index b27977e8aaed..4416b1026189 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -10,91 +10,36 @@
10 10
11 11
12#ifdef CONFIG_BLOCK 12#ifdef CONFIG_BLOCK
13static inline struct scsi_cmnd *scsi_mq_find_tag(struct Scsi_Host *shost,
14 int unique_tag)
15{
16 u16 hwq = blk_mq_unique_tag_to_hwq(unique_tag);
17 struct request *req = NULL;
18
19 if (hwq < shost->tag_set.nr_hw_queues)
20 req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq],
21 blk_mq_unique_tag_to_tag(unique_tag));
22 return req ? (struct scsi_cmnd *)req->special : NULL;
23}
24
25/**
26 * scsi_find_tag - find a tagged command by device
27 * @SDpnt: pointer to the ScSI device
28 * @tag: tag generated by blk_mq_unique_tag()
29 *
30 * Notes:
31 * Only works with tags allocated by the generic blk layer.
32 **/
33static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag)
34{
35 struct request *req;
36
37 if (tag != SCSI_NO_TAG) {
38 if (shost_use_blk_mq(sdev->host))
39 return scsi_mq_find_tag(sdev->host, tag);
40
41 req = blk_queue_find_tag(sdev->request_queue, tag);
42 return req ? (struct scsi_cmnd *)req->special : NULL;
43 }
44
45 /* single command, look in space */
46 return sdev->current_cmnd;
47}
48
49
50/**
51 * scsi_init_shared_tag_map - create a shared tag map
52 * @shost: the host to share the tag map among all devices
53 * @depth: the total depth of the map
54 */
55static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth)
56{
57 /*
58 * We always have a shared tag map around when using blk-mq.
59 */
60 if (shost_use_blk_mq(shost))
61 return 0;
62
63 /*
64 * If the shared tag map isn't already initialized, do it now.
65 * This saves callers from having to check ->bqt when setting up
66 * devices on the shared host (for libata)
67 */
68 if (!shost->bqt) {
69 shost->bqt = blk_init_tags(depth,
70 shost->hostt->tag_alloc_policy);
71 if (!shost->bqt)
72 return -ENOMEM;
73 }
74
75 return 0;
76}
77
78/** 13/**
79 * scsi_host_find_tag - find the tagged command by host 14 * scsi_host_find_tag - find the tagged command by host
80 * @shost: pointer to scsi_host 15 * @shost: pointer to scsi_host
81 * @tag: tag generated by blk_mq_unique_tag() 16 * @tag: tag
82 * 17 *
83 * Notes: 18 * Note: for devices using multiple hardware queues tag must have been
84 * Only works with tags allocated by the generic blk layer. 19 * generated by blk_mq_unique_tag().
85 **/ 20 **/
86static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost, 21static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost,
87 int tag) 22 int tag)
88{ 23{
89 struct request *req; 24 struct request *req = NULL;
90 25
91 if (tag != SCSI_NO_TAG) { 26 if (tag == SCSI_NO_TAG)
92 if (shost_use_blk_mq(shost)) 27 return NULL;
93 return scsi_mq_find_tag(shost, tag); 28
29 if (shost_use_blk_mq(shost)) {
30 u16 hwq = blk_mq_unique_tag_to_hwq(tag);
31
32 if (hwq < shost->tag_set.nr_hw_queues) {
33 req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq],
34 blk_mq_unique_tag_to_tag(tag));
35 }
36 } else {
94 req = blk_map_queue_find_tag(shost->bqt, tag); 37 req = blk_map_queue_find_tag(shost->bqt, tag);
95 return req ? (struct scsi_cmnd *)req->special : NULL;
96 } 38 }
97 return NULL; 39
40 if (!req)
41 return NULL;
42 return req->special;
98} 43}
99 44
100#endif /* CONFIG_BLOCK */ 45#endif /* CONFIG_BLOCK */