]> git.karo-electronics.de Git - linux-beck.git/commitdiff
scsi: use host wide tags by default
authorChristoph Hellwig <hch@lst.de>
Thu, 8 Oct 2015 08:28:04 +0000 (09:28 +0100)
committerJames Bottomley <JBottomley@Odin.com>
Tue, 10 Nov 2015 01:11:57 +0000 (17:11 -0800)
This patch changes the !blk-mq path to the same defaults as the blk-mq
I/O path by always enabling block tagging, and always using host wide
tags.  We've had blk-mq available for a few releases so bugs with
this mode should have been ironed out, and this ensures we get better
coverage of over tagging setup over different configs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
36 files changed:
drivers/ata/libata-scsi.c
drivers/infiniband/ulp/srp/ib_srp.c
drivers/message/fusion/mptsas.c
drivers/scsi/53c700.c
drivers/scsi/advansys.c
drivers/scsi/aic7xxx/aic79xx_osm.c
drivers/scsi/aic7xxx/aic7xxx_osm.c
drivers/scsi/aic94xx/aic94xx_init.c
drivers/scsi/bfa/bfad_im.c
drivers/scsi/bnx2fc/bnx2fc_fcoe.c
drivers/scsi/csiostor/csio_scsi.c
drivers/scsi/esas2r/esas2r_main.c
drivers/scsi/esp_scsi.c
drivers/scsi/fcoe/fcoe.c
drivers/scsi/fnic/fnic_main.c
drivers/scsi/hosts.c
drivers/scsi/hpsa.c
drivers/scsi/ibmvscsi/ibmvfc.c
drivers/scsi/ipr.c
drivers/scsi/isci/init.c
drivers/scsi/lpfc/lpfc_scsi.c
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/mvsas/mv_init.c
drivers/scsi/pm8001/pm8001_init.c
drivers/scsi/pmcraid.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qla4xxx/ql4_os.c
drivers/scsi/scsi.c
drivers/scsi/scsi_scan.c
drivers/scsi/snic/snic_main.c
drivers/scsi/stex.c
drivers/scsi/ufs/ufshcd.c
drivers/target/loopback/tcm_loop.c
drivers/usb/storage/uas.c
include/scsi/scsi_host.h
include/scsi/scsi_tcq.h

index 0d7f0da3a26929622080f94a2a3125c63676999e..ade388648fe7015ead6fc4c96b99c6fb74c0bff6 100644 (file)
@@ -3689,9 +3689,6 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
                 */
                shost->max_host_blocked = 1;
 
-               if (scsi_init_shared_tag_map(shost, host->n_tags))
-                       goto err_add;
-
                rc = scsi_add_host_with_dma(ap->scsi_host,
                                                &ap->tdev, ap->host->dev);
                if (rc)
index b481490ad25756f6de36cd718c0983be751c8e5c..96014dc4b6dd2b7d3ddd81e4fce18cf250dea699 100644 (file)
@@ -2750,7 +2750,6 @@ static struct scsi_host_template srp_template = {
        .cmd_per_lun                    = SRP_DEFAULT_CMD_SQ_SIZE,
        .use_clustering                 = ENABLE_CLUSTERING,
        .shost_attrs                    = srp_host_attrs,
-       .use_blk_tags                   = 1,
        .track_queue_depth              = 1,
 };
 
@@ -3181,10 +3180,6 @@ static ssize_t srp_create_target(struct device *dev,
        if (ret)
                goto out;
 
-       ret = scsi_init_shared_tag_map(target_host, target_host->can_queue);
-       if (ret)
-               goto out;
-
        target->req_ring_size = target->queue_size - SRP_TSK_MGMT_SQ_SIZE;
 
        if (!srp_conn_unique(target->srp_host, target)) {
index 005a88b9f44029c42b2c700fa4e275482039c47f..7ebccfa8072a7ff8075ab2e71197713afc397dcf 100644 (file)
@@ -1994,7 +1994,6 @@ static struct scsi_host_template mptsas_driver_template = {
        .cmd_per_lun                    = 7,
        .use_clustering                 = ENABLE_CLUSTERING,
        .shost_attrs                    = mptscsih_host_attrs,
-       .use_blk_tags                   = 1,
 };
 
 static int mptsas_get_linkerrors(struct sas_phy *phy)
index a209c341889830127fa6ca5e72bde71d141432e7..d4c285688ce98b8222dcc778ee646f6581e48df3 100644 (file)
@@ -325,7 +325,6 @@ NCR_700_detect(struct scsi_host_template *tpnt,
        tpnt->slave_destroy = NCR_700_slave_destroy;
        tpnt->slave_alloc = NCR_700_slave_alloc;
        tpnt->change_queue_depth = NCR_700_change_queue_depth;
-       tpnt->use_blk_tags = 1;
 
        if(tpnt->name == NULL)
                tpnt->name = "53c700";
@@ -1107,7 +1106,9 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
                        BUG();
                }
                if(hostdata->msgin[1] == A_SIMPLE_TAG_MSG) {
-                       struct scsi_cmnd *SCp = scsi_find_tag(SDp, hostdata->msgin[2]);
+                       struct scsi_cmnd *SCp;
+
+                       SCp = scsi_host_find_tag(SDp->host, hostdata->msgin[2]);
                        if(unlikely(SCp == NULL)) {
                                printk(KERN_ERR "scsi%d: (%d:%d) no saved request for tag %d\n", 
                                       host->host_no, reselection_id, lun, hostdata->msgin[2]);
@@ -1119,7 +1120,9 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
                                "reselection is tag %d, slot %p(%d)\n",
                                hostdata->msgin[2], slot, slot->tag);
                } else {
-                       struct scsi_cmnd *SCp = scsi_find_tag(SDp, SCSI_NO_TAG);
+                       struct scsi_cmnd *SCp;
+
+                       SCp = scsi_host_find_tag(SDp->host, SCSI_NO_TAG);
                        if(unlikely(SCp == NULL)) {
                                sdev_printk(KERN_ERR, SDp,
                                        "no saved request for untagged cmd\n");
@@ -1823,7 +1826,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
                       slot->tag, slot);
        } else {
                slot->tag = SCSI_NO_TAG;
-               /* must populate current_cmnd for scsi_find_tag to work */
+               /* must populate current_cmnd for scsi_host_find_tag to work */
                SCp->device->current_cmnd = SCp;
        }
        /* sanity check: some of the commands generated by the mid-layer
index 4305178e4e0147ba9a8f8e04a452e77947f2cddb..519f9a4b3dadf39c07be7e61f20fc2481cddbd02 100644 (file)
@@ -10819,7 +10819,6 @@ static struct scsi_host_template advansys_template = {
         * by enabling clustering, I/O throughput increases as well.
         */
        .use_clustering = ENABLE_CLUSTERING,
-       .use_blk_tags = 1,
 };
 
 static 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,
                /* Set maximum number of queues the adapter can handle. */
                shost->can_queue = adv_dvc_varp->max_host_qng;
        }
-       ret = scsi_init_shared_tag_map(shost, shost->can_queue);
-       if (ret) {
-               shost_printk(KERN_ERR, shost, "init tag map failed\n");
-               goto err_free_dma;
-       }
 
        /*
         * Set the maximum number of scatter-gather elements the
index ce96a0be32820fa6b75460adf9e4b7f48587ab05..2588b8f84ba0ec37108f3bfedb033cee44c47985 100644 (file)
@@ -925,7 +925,6 @@ struct scsi_host_template aic79xx_driver_template = {
        .slave_configure        = ahd_linux_slave_configure,
        .target_alloc           = ahd_linux_target_alloc,
        .target_destroy         = ahd_linux_target_destroy,
-       .use_blk_tags           = 1,
 };
 
 /******************************** Bus DMA *************************************/
index a2f2c774cd6b75f5874d71b5970a739a6923abaa..b846a4683562ca8ddd472becdb70a9a3d56387bf 100644 (file)
@@ -812,7 +812,6 @@ struct scsi_host_template aic7xxx_driver_template = {
        .slave_configure        = ahc_linux_slave_configure,
        .target_alloc           = ahc_linux_target_alloc,
        .target_destroy         = ahc_linux_target_destroy,
-       .use_blk_tags           = 1,
 };
 
 /**************************** Tasklet Handler *********************************/
index f6c336b05d5bbf6e0354c3f18697fd3350f3d09e..cd094bf82a7735d9f1a7683c0adb1658b92d9437 100644 (file)
@@ -73,7 +73,6 @@ static struct scsi_host_template aic94xx_sht = {
        .eh_bus_reset_handler   = sas_eh_bus_reset_handler,
        .target_destroy         = sas_target_destroy,
        .ioctl                  = sas_ioctl,
-       .use_blk_tags           = 1,
        .track_queue_depth      = 1,
 };
 
index 8367c11d554b22a6fb5b7c5385b56bbc7f156f45..299c6f80d4605116c5039cb1a23b77a0b4324d05 100644 (file)
@@ -800,7 +800,6 @@ struct scsi_host_template bfad_im_scsi_host_template = {
        .shost_attrs = bfad_im_host_attrs,
        .max_sectors = BFAD_MAX_SECTORS,
        .vendor_id = BFA_PCI_VENDOR_ID_BROCADE,
-       .use_blk_tags = 1,
 };
 
 struct scsi_host_template bfad_im_vport_template = {
@@ -822,7 +821,6 @@ struct scsi_host_template bfad_im_vport_template = {
        .use_clustering = ENABLE_CLUSTERING,
        .shost_attrs = bfad_im_vport_attrs,
        .max_sectors = BFAD_MAX_SECTORS,
-       .use_blk_tags = 1,
 };
 
 bfa_status_t
index 29a1c03b558e4149e490dcf48b4dbd987b591c4b..0857d80f2999d94f1bfc83eea6aa5c5ee02984ca 100644 (file)
@@ -2867,7 +2867,6 @@ static struct scsi_host_template bnx2fc_shost_template = {
        .use_clustering         = ENABLE_CLUSTERING,
        .sg_tablesize           = BNX2FC_MAX_BDS_PER_CMD,
        .max_sectors            = 1024,
-       .use_blk_tags           = 1,
        .track_queue_depth      = 1,
 };
 
index 2c4562d82dc06281dc9e9e51cf1e8a9701c041c1..c2a6f9f294271c5db4f2ec2b885d87b5ec849a4d 100644 (file)
@@ -2283,7 +2283,6 @@ struct scsi_host_template csio_fcoe_shost_template = {
        .use_clustering         = ENABLE_CLUSTERING,
        .shost_attrs            = csio_fcoe_lport_attrs,
        .max_sectors            = CSIO_MAX_SECTOR_SIZE,
-       .use_blk_tags           = 1,
 };
 
 struct scsi_host_template csio_fcoe_shost_vport_template = {
@@ -2303,7 +2302,6 @@ struct scsi_host_template csio_fcoe_shost_vport_template = {
        .use_clustering         = ENABLE_CLUSTERING,
        .shost_attrs            = csio_fcoe_vport_attrs,
        .max_sectors            = CSIO_MAX_SECTOR_SIZE,
-       .use_blk_tags           = 1,
 };
 
 /*
index 31f8966b2e037823857bcae96866e414c5709044..33581ba4386e8014290c6ce7e2931a35d8dc07c0 100644 (file)
@@ -256,7 +256,6 @@ static struct scsi_host_template driver_template = {
        .proc_name                      = ESAS2R_DRVR_NAME,
        .change_queue_depth             = scsi_change_queue_depth,
        .max_sectors                    = 0xFFFF,
-       .use_blk_tags                   = 1,
 };
 
 int sgl_page_size = 512;
index 065b25df741b601f7e51345ce1e56d687a09ee0c..71cb05b1c3ebdd9d3d3631ee2da4a44a72b40731 100644 (file)
@@ -2694,7 +2694,6 @@ struct scsi_host_template scsi_esp_template = {
        .use_clustering         = ENABLE_CLUSTERING,
        .max_sectors            = 0xffff,
        .skip_settle_delay      = 1,
-       .use_blk_tags           = 1,
 };
 EXPORT_SYMBOL(scsi_esp_template);
 
index d187ba9b361da070429d9e16c723b7d5569405cb..f4424063b860177c6501f4b8796c384b4fed1884 100644 (file)
@@ -287,7 +287,6 @@ static struct scsi_host_template fcoe_shost_template = {
        .use_clustering = ENABLE_CLUSTERING,
        .sg_tablesize = SG_ALL,
        .max_sectors = 0xffff,
-       .use_blk_tags = 1,
        .track_queue_depth = 1,
 };
 
index 8a0d4d7b3254d715c32cfcc41bb0fc66dd221221..58ce9020d69c5882eebfa46f3ec685fb7b63fef6 100644 (file)
@@ -118,7 +118,6 @@ static struct scsi_host_template fnic_host_template = {
        .sg_tablesize = FNIC_MAX_SG_DESC_CNT,
        .max_sectors = 0xffff,
        .shost_attrs = fnic_attrs,
-       .use_blk_tags = 1,
        .track_queue_depth = 1,
 };
 
@@ -697,13 +696,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        }
        fnic->fnic_max_tag_id = host->can_queue;
 
-       err = scsi_init_shared_tag_map(host, fnic->fnic_max_tag_id);
-       if (err) {
-               shost_printk(KERN_ERR, fnic->lport->host,
-                         "Unable to alloc shared tag map\n");
-               goto err_out_dev_close;
-       }
-
        host->max_lun = fnic->config.luns_per_tgt;
        host->max_id = FNIC_MAX_FCP_TARGET;
        host->max_cmd_len = FCOE_MAX_CMD_LEN;
index 8bb173e01084efb40b80121cda098651375ed3ce..323982fd00c3ba985dfb59bf04b6eff04f86e9b7 100644 (file)
@@ -217,6 +217,13 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
                error = scsi_mq_setup_tags(shost);
                if (error)
                        goto fail;
+       } else {
+               shost->bqt = blk_init_tags(shost->can_queue,
+                               shost->hostt->tag_alloc_policy);
+               if (!shost->bqt) {
+                       error = -ENOMEM;
+                       goto fail;
+               }
        }
 
        /*
index 40669f8dd0df12af584c581d71a151386d9155e2..7506b65d8e6c50fccb782be9ecd70ddcecd327eb 100644 (file)
@@ -4983,7 +4983,6 @@ static int hpsa_scan_finished(struct Scsi_Host *sh,
 static int hpsa_scsi_host_alloc(struct ctlr_info *h)
 {
        struct Scsi_Host *sh;
-       int error;
 
        sh = scsi_host_alloc(&hpsa_driver_template, sizeof(h));
        if (sh == NULL) {
@@ -5004,14 +5003,7 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h)
        sh->hostdata[0] = (unsigned long) h;
        sh->irq = h->intr[h->intr_mode];
        sh->unique_id = sh->irq;
-       error = scsi_init_shared_tag_map(sh, sh->can_queue);
-       if (error) {
-               dev_err(&h->pdev->dev,
-                       "%s: scsi_init_shared_tag_map failed for controller %d\n",
-                       __func__, h->ctlr);
-                       scsi_host_put(sh);
-                       return error;
-       }
+
        h->scsi_host = sh;
        return 0;
 }
index 057d27721d5b24d23e24c3040b64507507556400..6aa317c303e2dced686c76cc1102e563b4f058b1 100644 (file)
@@ -3095,7 +3095,6 @@ static struct scsi_host_template driver_template = {
        .max_sectors = IBMVFC_MAX_SECTORS,
        .use_clustering = ENABLE_CLUSTERING,
        .shost_attrs = ibmvfc_attrs,
-       .use_blk_tags = 1,
        .track_queue_depth = 1,
 };
 
index b62836ddbbee55c1fc7d6c65f4926a281fff387b..4f2c16778efaf6d4fc6c9b2c865a1999fa211f04 100644 (file)
@@ -6502,7 +6502,6 @@ static struct scsi_host_template driver_template = {
        .shost_attrs = ipr_ioa_attrs,
        .sdev_attrs = ipr_dev_attrs,
        .proc_name = IPR_NAME,
-       .use_blk_tags = 1,
 };
 
 /**
index 0dfcabe3ca7c2c7862b3712a391f2cd4ba19015a..2f973df72d9b42657e7b67cc764846016e58428f 100644 (file)
@@ -170,7 +170,6 @@ static struct scsi_host_template isci_sht = {
        .target_destroy                 = sas_target_destroy,
        .ioctl                          = sas_ioctl,
        .shost_attrs                    = isci_host_attrs,
-       .use_blk_tags                   = 1,
        .track_queue_depth              = 1,
 };
 
index 051b3b3bd625dea5891266a725ca514f8a98239b..4679ed4444a737e906342473031397b2137443ff 100644 (file)
@@ -5914,7 +5914,6 @@ struct scsi_host_template lpfc_template_s3 = {
        .max_sectors            = 0xFFFF,
        .vendor_id              = LPFC_NL_VENDOR_ID,
        .change_queue_depth     = scsi_change_queue_depth,
-       .use_blk_tags           = 1,
        .track_queue_depth      = 1,
 };
 
@@ -5940,7 +5939,6 @@ struct scsi_host_template lpfc_template = {
        .max_sectors            = 0xFFFF,
        .vendor_id              = LPFC_NL_VENDOR_ID,
        .change_queue_depth     = scsi_change_queue_depth,
-       .use_blk_tags           = 1,
        .track_queue_depth      = 1,
 };
 
@@ -5964,6 +5962,5 @@ struct scsi_host_template lpfc_vport_template = {
        .shost_attrs            = lpfc_vport_attrs,
        .max_sectors            = 0xFFFF,
        .change_queue_depth     = scsi_change_queue_depth,
-       .use_blk_tags           = 1,
        .track_queue_depth      = 1,
 };
index eaa81e552fd26f715122da4ee5e38427bb4ddb72..3b3f4809331b3c5bd196836afc626649e2c9ee9a 100644 (file)
@@ -5049,7 +5049,6 @@ static int megasas_start_aen(struct megasas_instance *instance)
 static int megasas_io_attach(struct megasas_instance *instance)
 {
        struct Scsi_Host *host = instance->host;
-       u32 error;
 
        /*
         * Export parameters required by SCSI mid-layer
@@ -5099,13 +5098,6 @@ static int megasas_io_attach(struct megasas_instance *instance)
                host->hostt->eh_device_reset_handler = NULL;
                host->hostt->eh_bus_reset_handler = NULL;
        }
-       error = scsi_init_shared_tag_map(host, host->can_queue);
-       if (error) {
-               dev_err(&instance->pdev->dev,
-                       "Failed to shared tag from %s %d\n",
-                       __func__, __LINE__);
-               return -ENODEV;
-       }
 
        /*
         * Notify the mid-layer about the new controller
index e2d555c1bffc16f94a87ed6b009d868cc3784a3e..221d25e9dc5fe4ec230679528460d189f3d881f8 100644 (file)
@@ -65,7 +65,6 @@ static struct scsi_host_template mvs_sht = {
        .target_destroy         = sas_target_destroy,
        .ioctl                  = sas_ioctl,
        .shost_attrs            = mvst_host_attrs,
-       .use_blk_tags           = 1,
        .track_queue_depth      = 1,
 };
 
index 5c0356fb6310ecfeb5c39cafe9bc75c7cb354002..e64b8bfafd805d63eedf714af2538001c149ed9f 100644 (file)
@@ -88,7 +88,6 @@ static struct scsi_host_template pm8001_sht = {
        .target_destroy         = sas_target_destroy,
        .ioctl                  = sas_ioctl,
        .shost_attrs            = pm8001_host_attrs,
-       .use_blk_tags           = 1,
        .track_queue_depth      = 1,
 };
 
index ed31d8cc62665cf919d6b31d3bad01c275104362..48d62249c226dff655b066d560cdc6fae939160e 100644 (file)
@@ -4254,7 +4254,6 @@ static struct scsi_host_template pmcraid_host_template = {
        .use_clustering = ENABLE_CLUSTERING,
        .shost_attrs = pmcraid_host_attrs,
        .proc_name = PMCRAID_DRIVER_NAME,
-       .use_blk_tags = 1,
 };
 
 /*
index c2dd17b1d26fa6b275268256623a167a8682019d..bfa9a64c316b6ca2eec9a1b2277608f68101d92d 100644 (file)
@@ -267,7 +267,6 @@ struct scsi_host_template qla2xxx_driver_template = {
        .shost_attrs            = qla2x00_host_attrs,
 
        .supported_mode         = MODE_INITIATOR,
-       .use_blk_tags           = 1,
        .track_queue_depth      = 1,
 };
 
index 6d25879d87c8550893cdd8671db68d542cde64cb..01c3610a60cf0b767f7566fc97967158f5eeb618 100644 (file)
@@ -212,7 +212,6 @@ static struct scsi_host_template qla4xxx_driver_template = {
        .shost_attrs            = qla4xxx_host_attrs,
        .host_reset             = qla4xxx_host_reset,
        .vendor_id              = SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC,
-       .use_blk_tags           = 1,
 };
 
 static struct iscsi_transport qla4xxx_iscsi_transport = {
@@ -8697,13 +8696,6 @@ static int qla4xxx_probe_adapter(struct pci_dev *pdev,
        host->can_queue = MAX_SRBS ;
        host->transportt = qla4xxx_scsi_transport;
 
-       ret = scsi_init_shared_tag_map(host, MAX_SRBS);
-       if (ret) {
-               ql4_printk(KERN_WARNING, ha,
-                          "%s: scsi_init_shared_tag_map failed\n", __func__);
-               goto probe_failed;
-       }
-
        pci_set_drvdata(pdev, ha);
 
        ret = scsi_add_host(host, &pdev->dev);
index 207d6a7a1bd0bce29ca748c8f3a4cd2aee6ad97a..d07fb653f5dc3348c41bbc68597489d2c4b25180 100644 (file)
@@ -616,32 +616,11 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
  */
 int scsi_change_queue_depth(struct scsi_device *sdev, int depth)
 {
-       unsigned long flags;
-
-       if (depth <= 0)
-               goto out;
-
-       spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
-
-       /*
-        * Check to see if the queue is managed by the block layer.
-        * If it is, and we fail to adjust the depth, exit.
-        *
-        * Do not resize the tag map if it is a host wide share bqt,
-        * because the size should be the hosts's can_queue. If there
-        * is more IO than the LLD's can_queue (so there are not enuogh
-        * tags) request_fn's host queue ready check will handle it.
-        */
-       if (!shost_use_blk_mq(sdev->host) && !sdev->host->bqt) {
-               if (blk_queue_tagged(sdev->request_queue) &&
-                   blk_queue_resize_tags(sdev->request_queue, depth) != 0)
-                       goto out_unlock;
+       if (depth > 0) {
+               sdev->queue_depth = depth;
+               wmb();
        }
 
-       sdev->queue_depth = depth;
-out_unlock:
-       spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
-out:
        return sdev->queue_depth;
 }
 EXPORT_SYMBOL(scsi_change_queue_depth);
index f9f3f8203d42709d9957aa27b1be471acb612046..998f3788d8e9e63dd560548d50c190c5f3abeeb5 100644 (file)
@@ -274,8 +274,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
        WARN_ON_ONCE(!blk_get_queue(sdev->request_queue));
        sdev->request_queue->queuedata = sdev;
 
-       if (!shost_use_blk_mq(sdev->host) &&
-           (shost->bqt || shost->hostt->use_blk_tags)) {
+       if (!shost_use_blk_mq(sdev->host)) {
                blk_queue_init_tags(sdev->request_queue,
                                    sdev->host->cmd_per_lun, shost->bqt,
                                    shost->hostt->tag_alloc_policy);
index b2b87cef00fcce3c2f765a71cd7020f7c5790e32..2b3c25371d769e4626c6c91898a848c1f995def4 100644 (file)
@@ -124,7 +124,6 @@ static struct scsi_host_template snic_host_template = {
        .sg_tablesize = SNIC_MAX_SG_DESC_CNT,
        .max_sectors = 0x800,
        .shost_attrs = snic_attrs,
-       .use_blk_tags = 1,
        .track_queue_depth = 1,
        .cmd_size = sizeof(struct snic_internal_io_state),
        .proc_name = "snic_scsi",
@@ -533,15 +532,6 @@ snic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        snic->max_tag_id = shost->can_queue;
 
-       ret = scsi_init_shared_tag_map(shost, snic->max_tag_id);
-       if (ret) {
-               SNIC_HOST_ERR(shost,
-                             "Unable to alloc shared tag map. %d\n",
-                             ret);
-
-               goto err_dev_close;
-       }
-
        shost->max_lun = snic->config.luns_per_tgt;
        shost->max_id = SNIC_MAX_TARGET;
 
index 98a62bc15069773ba2de93dd9d4164e8655919f0..56353cd9abd3ff362d3f784fd816ef8bbca6fdd7 100644 (file)
@@ -1374,7 +1374,6 @@ static struct scsi_host_template driver_template = {
        .eh_abort_handler               = stex_abort,
        .eh_host_reset_handler          = stex_reset,
        .this_id                        = -1,
-       .use_blk_tags                   = 1,
 };
 
 static 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)
        if (err)
                goto out_free_irq;
 
-       err = scsi_init_shared_tag_map(host, host->can_queue);
-       if (err) {
-               printk(KERN_ERR DRV_NAME "(%s): init shared queue failed\n",
-                       pci_name(pdev));
-               goto out_free_irq;
-       }
-
        pci_set_drvdata(pdev, hba);
 
        err = scsi_add_host(host, &pdev->dev);
index b0ade73f8c6a66a6a5f4d32fcbc4ac266b43d7eb..9065eb4516776749407731994d2b4541a5ba285a 100644 (file)
@@ -4355,7 +4355,6 @@ static struct scsi_host_template ufshcd_driver_template = {
        .cmd_per_lun            = UFSHCD_CMD_PER_LUN,
        .can_queue              = UFSHCD_CAN_QUEUE,
        .max_host_blocked       = 1,
-       .use_blk_tags           = 1,
        .track_queue_depth      = 1,
 };
 
@@ -5619,13 +5618,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
                hba->is_irq_enabled = true;
        }
 
-       /* Enable SCSI tag mapping */
-       err = scsi_init_shared_tag_map(host, host->can_queue);
-       if (err) {
-               dev_err(hba->dev, "init shared queue failed\n");
-               goto exit_gating;
-       }
-
        err = scsi_add_host(host, hba->dev);
        if (err) {
                dev_err(hba->dev, "scsi_add_host failed\n");
index 5bc85ffed7204f21871a31d7346b93885b437cf8..081f1cfefeb33871129b005ac397a73949a95a9c 100644 (file)
@@ -377,7 +377,6 @@ static struct scsi_host_template tcm_loop_driver_template = {
        .use_clustering         = DISABLE_CLUSTERING,
        .slave_alloc            = tcm_loop_slave_alloc,
        .module                 = THIS_MODULE,
-       .use_blk_tags           = 1,
        .track_queue_depth      = 1,
 };
 
index f689219095526a76076010eee2d1e3df82fa8e73..2850663f51263712c78f1f52fec7c91b2e374679 100644 (file)
@@ -812,7 +812,6 @@ static struct scsi_host_template uas_host_template = {
        .this_id = -1,
        .sg_tablesize = SG_NONE,
        .skip_settle_delay = 1,
-       .use_blk_tags = 1,
 };
 
 #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)
        if (result)
                goto set_alt0;
 
-       result = scsi_init_shared_tag_map(shost, devinfo->qdepth - 2);
-       if (result)
-               goto free_streams;
-
        usb_set_intfdata(intf, shost);
        result = scsi_add_host(shost, &intf->dev);
        if (result)
index e113c757d555ef097954a4b41137f4d4b5a8f4e1..ed527121031dd31b424c1ff596f9139cfcdefd02 100644 (file)
@@ -405,11 +405,6 @@ struct scsi_host_template {
        /* If use block layer to manage tags, this is tag allocation policy */
        int tag_alloc_policy;
 
-       /*
-        * Let the block layer assigns tags to all commands.
-        */
-       unsigned use_blk_tags:1;
-
        /*
         * Track QUEUE_FULL events and reduce queue depth on demand.
         */
index b27977e8aaed9b12bf6497fbdf01879a47b26cbc..4416b1026189c182bb75fbc5f677f587007522a7 100644 (file)
 
 
 #ifdef CONFIG_BLOCK
-static inline struct scsi_cmnd *scsi_mq_find_tag(struct Scsi_Host *shost,
-                                                int unique_tag)
-{
-       u16 hwq = blk_mq_unique_tag_to_hwq(unique_tag);
-       struct request *req = NULL;
-
-       if (hwq < shost->tag_set.nr_hw_queues)
-               req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq],
-                                      blk_mq_unique_tag_to_tag(unique_tag));
-       return req ? (struct scsi_cmnd *)req->special : NULL;
-}
-
-/**
- * scsi_find_tag - find a tagged command by device
- * @SDpnt:     pointer to the ScSI device
- * @tag:       tag generated by blk_mq_unique_tag()
- *
- * Notes:
- *     Only works with tags allocated by the generic blk layer.
- **/
-static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag)
-{
-        struct request *req;
-
-        if (tag != SCSI_NO_TAG) {
-               if (shost_use_blk_mq(sdev->host))
-                       return scsi_mq_find_tag(sdev->host, tag);
-
-               req = blk_queue_find_tag(sdev->request_queue, tag);
-               return req ? (struct scsi_cmnd *)req->special : NULL;
-       }
-
-       /* single command, look in space */
-       return sdev->current_cmnd;
-}
-
-
-/**
- * scsi_init_shared_tag_map - create a shared tag map
- * @shost:     the host to share the tag map among all devices
- * @depth:     the total depth of the map
- */
-static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth)
-{
-       /*
-        * We always have a shared tag map around when using blk-mq.
-        */
-       if (shost_use_blk_mq(shost))
-               return 0;
-
-       /*
-        * If the shared tag map isn't already initialized, do it now.
-        * This saves callers from having to check ->bqt when setting up
-        * devices on the shared host (for libata)
-        */
-       if (!shost->bqt) {
-               shost->bqt = blk_init_tags(depth,
-                       shost->hostt->tag_alloc_policy);
-               if (!shost->bqt)
-                       return -ENOMEM;
-       }
-
-       return 0;
-}
-
 /**
  * scsi_host_find_tag - find the tagged command by host
  * @shost:     pointer to scsi_host
- * @tag:       tag generated by blk_mq_unique_tag()
+ * @tag:       tag
  *
- * Notes:
- *     Only works with tags allocated by the generic blk layer.
+ * Note: for devices using multiple hardware queues tag must have been
+ * generated by blk_mq_unique_tag().
  **/
 static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost,
-                                               int tag)
+               int tag)
 {
-       struct request *req;
+       struct request *req = NULL;
 
-       if (tag != SCSI_NO_TAG) {
-               if (shost_use_blk_mq(shost))
-                       return scsi_mq_find_tag(shost, tag);
+       if (tag == SCSI_NO_TAG)
+               return NULL;
+
+       if (shost_use_blk_mq(shost)) {
+               u16 hwq = blk_mq_unique_tag_to_hwq(tag);
+
+               if (hwq < shost->tag_set.nr_hw_queues) {
+                       req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq],
+                               blk_mq_unique_tag_to_tag(tag));
+               }
+       } else {
                req = blk_map_queue_find_tag(shost->bqt, tag);
-               return req ? (struct scsi_cmnd *)req->special : NULL;
        }
-       return NULL;
+
+       if (!req)
+               return NULL;
+       return req->special;
 }
 
 #endif /* CONFIG_BLOCK */