From patchwork Wed Jan 27 03:55:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Desai X-Patchwork-Id: 12049843 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 4F52CC433E9 for ; Wed, 27 Jan 2021 12:00:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0448F20780 for ; Wed, 27 Jan 2021 12:00:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233942AbhA0MAn (ORCPT ); Wed, 27 Jan 2021 07:00:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237271AbhA0L6F (ORCPT ); Wed, 27 Jan 2021 06:58:05 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B402BC0617A7 for ; Wed, 27 Jan 2021 03:55:22 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id j12so1023861pfj.12 for ; Wed, 27 Jan 2021 03:55:22 -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=RszbbwTwiDL9y3JMOrFKfRW9OvrKVPeIM1H2Gv7BqUk=; b=OahgBIUvOPymcG8j/j9emvWGAMpuNJyvwIjfrORmFViM62z23LTF1pvF2RB5q8MFyu u1mR6L7XFCn8Y7FUj92+Pa7esYDfIpMUa6OGh/M20KGzjby+SM0dqc3IHoiVtmUIVWFh HvBaV9q521QnhjNGBxPYL7WgiuB0tbc+N5pnM= 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=RszbbwTwiDL9y3JMOrFKfRW9OvrKVPeIM1H2Gv7BqUk=; b=Dld7pxS02S9co+UyoLgMERSMKnyyqESk/mra918oolqz0ttCDEST/kTd6YhPPibPPk H9z2eDOL5gRZDel/Hne2CO0chiV/npcIbJVkXUvfDly5qQ3JOQLvHVjxlqumM+6qo+fT Pb+qTezoWenORRx0TBUG6v4wkmB7k8fb5GWl1j8S7zdAizOrwUwvQg8uuerCRLrkajIk BLM8VfKZfiEVEusdhn9UpAE8850KX3KBsqeLFKizhNOxDqlXDzN2nEI556B9oVUt0vYf lj7vwDItxW6P7tMzkGM4IsqVkUjb2zK4xyovykV2P26meTaUv77ln5bgWu5Isd+DeZOR kG/w== X-Gm-Message-State: AOAM531sIievNMo3//NX1DBrSz8lXagIiwwXx5Nr06PMOBXpAYO472cj Pmgtro8nNtDHPIgvZwipPdSr9rfUs/OhxaVJAMQKGnfNYfjUWoYH2jDVAvUzpx2wrfJB3E8cIXI wHZu2R5ixxHcxc0J9RhXmA2OgKv72MNOTHUoevAXIpDDdjj75CSXu5pvmZoYeOdKrCsfNe+5Vov xWSt19/FnB X-Google-Smtp-Source: ABdhPJz8JY+GMe/OI+AwPodlNNb7nshmjP6naqcBpSmJIara96MytZR2lp6tZLLYlQo5Qx/Q7qVG9g== X-Received: by 2002:a63:5952:: with SMTP id j18mr10964519pgm.29.1611748521884; Wed, 27 Jan 2021 03:55:21 -0800 (PST) Received: from drv-bst-rhel8.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id l190sm2235552pfl.205.2021.01.27.03.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jan 2021 03:55:21 -0800 (PST) From: Kashyap Desai To: linux-scsi@vger.kernel.org Cc: Kashyap Desai Subject: [RESEND PATCH v2 4/4] scsi: set shost as hctx driver_data Date: Wed, 27 Jan 2021 09:25:27 +0530 Message-Id: <20210127035527.40622-5-kashyap.desai@broadcom.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210127035527.40622-1-kashyap.desai@broadcom.com> References: <20210127035527.40622-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 --- 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, };