Skip to content

Commit

Permalink
scsi: core: Set shost as hctx driver_data
Browse files Browse the repository at this point in the history
hctx->driver_data is not set for SCSI currently. Set hctx->driver_data =
shost.

Link: https://lore.kernel.org/r/20210215074048.19424-6-kashyap.desai@broadcom.com
Suggested-by: John Garry <john.garry@huawei.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Kashyap Desai authored and Martin K. Petersen committed Mar 4, 2021
1 parent 4a0c6f4 commit 4309ea7
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1813,16 +1813,23 @@ static void scsi_mq_exit_request(struct blk_mq_tag_set *set, struct request *rq,

static int scsi_mq_poll(struct blk_mq_hw_ctx *hctx)
{
struct request_queue *q = hctx->queue;
struct scsi_device *sdev = q->queuedata;
struct Scsi_Host *shost = sdev->host;
struct Scsi_Host *shost = hctx->driver_data;

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

return 0;
}

static int scsi_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
unsigned int hctx_idx)
{
struct Scsi_Host *shost = data;

hctx->driver_data = shost;
return 0;
}

static int scsi_map_queues(struct blk_mq_tag_set *set)
{
struct Scsi_Host *shost = container_of(set, struct Scsi_Host, tag_set);
Expand Down Expand Up @@ -1890,6 +1897,7 @@ static const struct blk_mq_ops scsi_mq_ops_no_commit = {
.cleanup_rq = scsi_cleanup_rq,
.busy = scsi_mq_lld_busy,
.map_queues = scsi_map_queues,
.init_hctx = scsi_init_hctx,
.poll = scsi_mq_poll,
.set_rq_budget_token = scsi_mq_set_rq_budget_token,
.get_rq_budget_token = scsi_mq_get_rq_budget_token,
Expand All @@ -1898,9 +1906,7 @@ static const struct blk_mq_ops scsi_mq_ops_no_commit = {

static void scsi_commit_rqs(struct blk_mq_hw_ctx *hctx)
{
struct request_queue *q = hctx->queue;
struct scsi_device *sdev = q->queuedata;
struct Scsi_Host *shost = sdev->host;
struct Scsi_Host *shost = hctx->driver_data;

shost->hostt->commit_rqs(shost, hctx->queue_num);
}
Expand All @@ -1921,6 +1927,7 @@ static const struct blk_mq_ops scsi_mq_ops = {
.cleanup_rq = scsi_cleanup_rq,
.busy = scsi_mq_lld_busy,
.map_queues = scsi_map_queues,
.init_hctx = scsi_init_hctx,
.poll = scsi_mq_poll,
.set_rq_budget_token = scsi_mq_set_rq_budget_token,
.get_rq_budget_token = scsi_mq_get_rq_budget_token,
Expand Down

0 comments on commit 4309ea7

Please sign in to comment.