From patchwork Mon Feb 1 05:16:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Desai X-Patchwork-Id: 374437 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MIME_HEADER_CTYPE_ONLY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FC26C433E6 for ; Mon, 1 Feb 2021 13:18:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0D2B64EA2 for ; Mon, 1 Feb 2021 13:18:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231674AbhBANST (ORCPT ); Mon, 1 Feb 2021 08:18:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231778AbhBANRj (ORCPT ); Mon, 1 Feb 2021 08:17:39 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF79C06178C for ; Mon, 1 Feb 2021 05:16:18 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id e9so10908916pjj.0 for ; Mon, 01 Feb 2021 05:16:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kEfaHvb22cBHOFzHkDkzr6FYclDR4ti3FncQ6m3O4Og=; b=XvNEGUbdCVFT+CgSbRxzdz4a3JC8M0aCJUqOu7zFmiThgei1UXSeBrZNK9cuYCrctM n5J5OKDEnDQ/X29Ge6JvLmJ2mOIdPhqAlWvIiOkTpP4Z1KP4UJORJKSe5OFHN08pKDf1 AX40HiCx3Xw6Gi/9pzhdk3mYVFZMczV++Gb9o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kEfaHvb22cBHOFzHkDkzr6FYclDR4ti3FncQ6m3O4Og=; b=RrbSxGxKkke7Ai63NJ9SEuO42oWx90M4PMHN0eC0Sj/kYHw555ID5/x6qBAz+72Epm 6otgMaSeJ5DZRKPNEe6m97dcLuu9A8bzGStOh3DcZlR7rotfAUPWaKKz/0vN35X7++sk RD1IFw+jlEaUfivgugEwp6IzIa4IU+qMe2b9CxmZII1nyo4ELQ2+m1f2XUO8YOh4WlrI mZ1CFeBmlo7Oqmby60GlixrPKwsi24ln+SBstdWpuYtehGdoW4MwZ/jzhqP1Mo9wxfoi R81V6bFDcEjyDSv2XM/NeMlkfWjcTHJtc7Q9OK9+SUqgPhlAaML2scIwFkVXKYm4xX77 hD2w== X-Gm-Message-State: AOAM532Bdlay7lw0Qc16YFBuXzLiRO++2IP5MmFi90kUbn5B5isL/s6t N2jJhKZL6+P/OthfdfhLOhsDkuaHMysnQKiESF/ISn/zJuaZ2LcPjtu77E104pX73YJenBiVavk Y5u1v2Oda6hGCnfrrbS57lUcOIfNT4rbWJyIxk/D7SXUsYnnEvUm2eHcvHwS4/KDUddbrf/8nTK 6URWPts6JV X-Google-Smtp-Source: ABdhPJzM1G6J22zBh4nkIUYmdL5kxIgC9UNNKzG/2KLZapO9+jWSEmEVst9yOHADO84ohbOrXaBLmw== X-Received: by 2002:a17:90a:8e82:: with SMTP id f2mr17126080pjo.234.1612185377779; Mon, 01 Feb 2021 05:16:17 -0800 (PST) Received: from drv-bst-rhel8.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id h2sm18573898pfk.4.2021.02.01.05.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 05:16:17 -0800 (PST) From: Kashyap Desai To: linux-scsi@vger.kernel.org Cc: Kashyap Desai Subject: [PATCH v3 4/4] scsi: set shost as hctx driver_data Date: Mon, 1 Feb 2021 10:46:19 +0530 Message-Id: <20210201051619.19909-5-kashyap.desai@broadcom.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210201051619.19909-1-kashyap.desai@broadcom.com> References: <20210201051619.19909-1-kashyap.desai@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org hctx->driver_data is not set for SCSI currently. Separately set hctx->driver_data = shost. Suggested-by: John Garry Signed-off-by: Kashyap Desai Reviewed-by: John Garry Reviewed-by: Hannes Reinecke --- drivers/scsi/scsi_lib.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 8c29bf0e4cfd..f661c50f3b88 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1792,9 +1792,7 @@ 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); @@ -1802,6 +1800,15 @@ static int scsi_mq_poll(struct blk_mq_hw_ctx *hctx) 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); @@ -1869,15 +1876,14 @@ 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, }; 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); } @@ -1898,6 +1904,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, };