2019-03-12 00:57:56

by Dongli Zhang

[permalink] [raw]
Subject: [PATCH 0/4] scsi: cleanup hardcoding by replacing 0 by HCTX_TYPE_DEFAULT

As in commit 7d76f8562f4c ("blk-mq: use HCTX_TYPE_DEFAULT but not 0 to
index blk_mq_tag_set->map"), this patch set cleanup driver/scsi/* to index
blk_mq_tag_set->map[] with HCTX_TYPE_DEFAULT, but not 0.

drivers/scsi/qla2xxx/qla_os.c | 2 +-
drivers/scsi/scsi_lib.c | 2 +-
drivers/scsi/smartpqi/smartpqi_init.c | 2 +-
drivers/scsi/virtio_scsi.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

Dongli Zhang



2019-03-12 00:58:00

by Dongli Zhang

[permalink] [raw]
Subject: [PATCH 1/4] scsi: replace 0 by HCTX_TYPE_DEFAULT to index blk_mq_tag_set->map

Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.

Signed-off-by: Dongli Zhang <[email protected]>
---
drivers/scsi/scsi_lib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 2018967..985cfc2 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1759,7 +1759,7 @@ static int scsi_map_queues(struct blk_mq_tag_set *set)

if (shost->hostt->map_queues)
return shost->hostt->map_queues(shost);
- return blk_mq_map_queues(&set->map[0]);
+ return blk_mq_map_queues(&set->map[HCTX_TYPE_DEFAULT]);
}

void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
--
2.7.4


2019-03-12 00:58:03

by Dongli Zhang

[permalink] [raw]
Subject: [PATCH 4/4] scsi: smartpqi: replace 0 by HCTX_TYPE_DEFAULT to index blk_mq_tag_set->map

Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.

Signed-off-by: Dongli Zhang <[email protected]>
---
drivers/scsi/smartpqi/smartpqi_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 5d9ccba..68aea2a 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -5789,7 +5789,7 @@ static int pqi_map_queues(struct Scsi_Host *shost)
{
struct pqi_ctrl_info *ctrl_info = shost_to_hba(shost);

- return blk_mq_pci_map_queues(&shost->tag_set.map[0],
+ return blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
ctrl_info->pci_dev, 0);
}

--
2.7.4


2019-03-12 00:58:41

by Dongli Zhang

[permalink] [raw]
Subject: [PATCH 2/4] scsi: virtio_scsi: replace 0 by HCTX_TYPE_DEFAULT to index blk_mq_tag_set->map

Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.

Signed-off-by: Dongli Zhang <[email protected]>
---
drivers/scsi/virtio_scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 1a6f150..e5de26b 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -661,7 +661,7 @@ static int virtscsi_abort(struct scsi_cmnd *sc)
static int virtscsi_map_queues(struct Scsi_Host *shost)
{
struct virtio_scsi *vscsi = shost_priv(shost);
- struct blk_mq_queue_map *qmap = &shost->tag_set.map[0];
+ struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];

return blk_mq_virtio_map_queues(qmap, vscsi->vdev, 2);
}
--
2.7.4


2019-03-12 00:58:47

by Dongli Zhang

[permalink] [raw]
Subject: [PATCH 3/4] scsi: qla2xxx: replace 0 by HCTX_TYPE_DEFAULT to index blk_mq_tag_set->map

Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.

Signed-off-by: Dongli Zhang <[email protected]>
---
drivers/scsi/qla2xxx/qla_os.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 677f82f..9e22cfc 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -7179,7 +7179,7 @@ static int qla2xxx_map_queues(struct Scsi_Host *shost)
{
int rc;
scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata;
- struct blk_mq_queue_map *qmap = &shost->tag_set.map[0];
+ struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];

if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase)
rc = blk_mq_map_queues(qmap);
--
2.7.4


2019-03-19 18:45:50

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH 0/4] scsi: cleanup hardcoding by replacing 0 by HCTX_TYPE_DEFAULT


Dongli,

> As in commit 7d76f8562f4c ("blk-mq: use HCTX_TYPE_DEFAULT but not 0 to
> index blk_mq_tag_set->map"), this patch set cleanup driver/scsi/* to
> index blk_mq_tag_set->map[] with HCTX_TYPE_DEFAULT, but not 0.

Applied to 5.2/scsi-queue, thanks!

--
Martin K. Petersen Oracle Linux Engineering