Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2943558pxp; Tue, 22 Mar 2022 08:58:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcoPQ/JTIcLzZZKdrwvbB48e6VAHgp7V3PQYbmW43Sssn7Sl1hw7jP4t8FgfpWgfcEWTcC X-Received: by 2002:a05:6402:3586:b0:419:6059:f016 with SMTP id y6-20020a056402358600b004196059f016mr2697347edc.402.1647964681422; Tue, 22 Mar 2022 08:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647964681; cv=none; d=google.com; s=arc-20160816; b=qSstNryYKAxWU0Uo4gg7O3Cqo+JwwOVJfECcoCGFvtZYTPu1YkBzugnXzcjr2JR3vE XZdtBImKO1TO8clO8jTspGHf2JV3WzKvHNluzMjUe8U9F2zHmEB1QOhExAg15YKX51oU aIa7apVQlUtT6beTlHL+AuR9sg7pdUKv2CarZ6Vj16Y2DWetzn8NPd/2EumHvUVgYoh9 bDwpSfL4srYorp08LW+jpFjv4QpihqRKmSWwY7p0YkISk5BelLhqqFOCnDjJbylNH9b8 9GMbpgSup5ZbAV3djgXgB23/zILUaruNYQ9E0yglv+FdAhVGdURRNbnjkK6YNR7KZfXr 2WGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Q4g9cjJmTNuJO8UUGH9exah5eIg8ROBT+2ZsTatfs8I=; b=lUxXqKXUJpDKQZ7wvD107OVZbrawSa2iGE3KbHAmDRFWa34bqe3rupbGkHpXuILNSj LmyAnZhm40ZloziniwS7Skv1UG5o/KM0ts1IYCVwE9vFyzvtvFBC3aNnnBGPeNFm8T6G MDPryJkeo3yJh84Oiy8I7jRD0V4zyop1pt5KRyqQan02r5GBqhGEWmg4ubKUYHhWM5qe vav54k7OErdxK5K81u4W4iLFH0ePnqE3UPaOkTqFE1Fjy3mZhGfepv4Xph7AFRAav2Cn ACooPDBhSQlnCrxUP2kvLyGdnx/R9bB4RfGmQCyFe81fgfSDIlVQkzpsJBSv6hlNKg7S vN/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z30-20020a50cd1e000000b00418f00c5838si11295740edi.451.2022.03.22.08.57.34; Tue, 22 Mar 2022 08:58:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233713AbiCVKrz (ORCPT + 99 others); Tue, 22 Mar 2022 06:47:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233542AbiCVKrl (ORCPT ); Tue, 22 Mar 2022 06:47:41 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E15482D03; Tue, 22 Mar 2022 03:46:04 -0700 (PDT) Received: from fraeml743-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4KN7QY2LN3z67xWw; Tue, 22 Mar 2022 18:44:21 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml743-chm.china.huawei.com (10.206.15.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 22 Mar 2022 11:46:02 +0100 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 22 Mar 2022 10:45:58 +0000 From: John Garry To: , , , , , , , CC: , , , , , , , John Garry Subject: [PATCH 06/11] scsi: core: Add scsi_alloc_request_hwq() Date: Tue, 22 Mar 2022 18:39:40 +0800 Message-ID: <1647945585-197349-7-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1647945585-197349-1-git-send-email-john.garry@huawei.com> References: <1647945585-197349-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a variant of scsi_alloc_request() which allocates a request for a specific hw queue. Signed-off-by: John Garry --- drivers/scsi/scsi_lib.c | 12 ++++++++++++ include/scsi/scsi_cmnd.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index d230392f2b4a..543cc01b2816 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1137,6 +1137,18 @@ struct request *scsi_alloc_request(struct request_queue *q, } EXPORT_SYMBOL_GPL(scsi_alloc_request); +struct request *scsi_alloc_request_hwq(struct request_queue *q, + unsigned int op, blk_mq_req_flags_t flags, unsigned int hwq) +{ + struct request *rq; + + rq = blk_mq_alloc_request_hctx(q, op, flags, hwq); + if (!IS_ERR(rq)) + scsi_initialize_rq(rq); + return rq; +} +EXPORT_SYMBOL_GPL(scsi_alloc_request_hwq); + /* * Only called when the request isn't completed by SCSI, and not freed by * SCSI diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index ad4bcace1390..94e65f4c81b5 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -399,4 +399,7 @@ extern void scsi_build_sense(struct scsi_cmnd *scmd, int desc, struct request *scsi_alloc_request(struct request_queue *q, unsigned int op, blk_mq_req_flags_t flags); +struct request *scsi_alloc_request_hwq(struct request_queue *q, + unsigned int op, blk_mq_req_flags_t flags, unsigned int hwq); + #endif /* _SCSI_SCSI_CMND_H */ -- 2.26.2