Skip to content

Commit 4309ea7

Browse files
kadesai16martinkpetersen
authored andcommitted
scsi: core: Set shost as hctx driver_data
hctx->driver_data is not set for SCSI currently. Set hctx->driver_data = shost. Link: https://lore.kernel.org/r/[email protected] Suggested-by: John Garry <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Kashyap Desai <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 4a0c6f4 commit 4309ea7

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

drivers/scsi/scsi_lib.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,16 +1813,23 @@ static void scsi_mq_exit_request(struct blk_mq_tag_set *set, struct request *rq,
18131813

18141814
static int scsi_mq_poll(struct blk_mq_hw_ctx *hctx)
18151815
{
1816-
struct request_queue *q = hctx->queue;
1817-
struct scsi_device *sdev = q->queuedata;
1818-
struct Scsi_Host *shost = sdev->host;
1816+
struct Scsi_Host *shost = hctx->driver_data;
18191817

18201818
if (shost->hostt->mq_poll)
18211819
return shost->hostt->mq_poll(shost, hctx->queue_num);
18221820

18231821
return 0;
18241822
}
18251823

1824+
static int scsi_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
1825+
unsigned int hctx_idx)
1826+
{
1827+
struct Scsi_Host *shost = data;
1828+
1829+
hctx->driver_data = shost;
1830+
return 0;
1831+
}
1832+
18261833
static int scsi_map_queues(struct blk_mq_tag_set *set)
18271834
{
18281835
struct Scsi_Host *shost = container_of(set, struct Scsi_Host, tag_set);
@@ -1890,6 +1897,7 @@ static const struct blk_mq_ops scsi_mq_ops_no_commit = {
18901897
.cleanup_rq = scsi_cleanup_rq,
18911898
.busy = scsi_mq_lld_busy,
18921899
.map_queues = scsi_map_queues,
1900+
.init_hctx = scsi_init_hctx,
18931901
.poll = scsi_mq_poll,
18941902
.set_rq_budget_token = scsi_mq_set_rq_budget_token,
18951903
.get_rq_budget_token = scsi_mq_get_rq_budget_token,
@@ -1898,9 +1906,7 @@ static const struct blk_mq_ops scsi_mq_ops_no_commit = {
18981906

18991907
static void scsi_commit_rqs(struct blk_mq_hw_ctx *hctx)
19001908
{
1901-
struct request_queue *q = hctx->queue;
1902-
struct scsi_device *sdev = q->queuedata;
1903-
struct Scsi_Host *shost = sdev->host;
1909+
struct Scsi_Host *shost = hctx->driver_data;
19041910

19051911
shost->hostt->commit_rqs(shost, hctx->queue_num);
19061912
}
@@ -1921,6 +1927,7 @@ static const struct blk_mq_ops scsi_mq_ops = {
19211927
.cleanup_rq = scsi_cleanup_rq,
19221928
.busy = scsi_mq_lld_busy,
19231929
.map_queues = scsi_map_queues,
1930+
.init_hctx = scsi_init_hctx,
19241931
.poll = scsi_mq_poll,
19251932
.set_rq_budget_token = scsi_mq_set_rq_budget_token,
19261933
.get_rq_budget_token = scsi_mq_get_rq_budget_token,

0 commit comments

Comments
 (0)