From patchwork Tue Oct 25 10:18:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 10682 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp909026wru; Tue, 25 Oct 2022 02:56:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66t4uG2yTr72KhGMUchz2Jk+afCNe0nIAsx2VCTFt9vu1+nbmmQ0bINCKYcso/LFtFT5Jk X-Received: by 2002:a17:90a:29e4:b0:20a:f9d5:c10e with SMTP id h91-20020a17090a29e400b0020af9d5c10emr80732300pjd.132.1666691766236; Tue, 25 Oct 2022 02:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666691766; cv=none; d=google.com; s=arc-20160816; b=VbTbFdrzTwiW0fI427ozEAWyJgd12wB2RsnDjgxRsuqW8opS++9WYLYgvq6mi34m+Y f86oafmWKzMIt0mReHajtClcNEpEnfmlTblU0G4nltr/I4sx3tBu1uhnroYuoGwdPx02 2iAl8PwaK1SPCEMI22nyRJixLr6OG2eXZnjBeg39syt9LMCBWCh/s3KVI2dlCq4kI8yV ejHnynldBjQKuwK8rKSFIO32dV+SLng7t8yO1EI2exGqomoQD86P6eVRMmIHAkEwJEkr PuX3XFYpu/PaWiRiP5U7SoBrwLH2jX1u0EMoK7+kYzVkKzCsq6EaaHW7JcH8NGHB4hy/ oT3Q== 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=OQc+3n3P39F/V/5qU2BlJusBFuohXs/jYChAQypY/po=; b=FjRQ0Y+y9s/MAzezIHI9tNXkyhn5HwSyMC5oCIDtx3SE2gzq1/uJ/fUKdXCZ0pl/4G BNK9hUdWkCf40HFZDc0BUI6Zz6V8RD0C9cpyde413YQFDtGj0tFOIn7bXy5blGH/1c/I 77AOH3C6zynqrS8rqbk5/F/p5fObJhc48AmTLsnN+ffdI1ml3zDzCz6jooo4Gn+FqA8Q SW9Z0TFm888ZqIr+mRttiAIWBTTm7scRV3HMIxET7BNFilm1MKCbRlAWddmyWtjc+Avz S8lTq18HWZU8s14GqzoqVbLIvrWwX4WKAmPUmh3LgK+r6OTJ1NnbskEc8BgvQeS58t8Q 4Vtg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 127-20020a621985000000b0056362152f8fsi2393660pfz.253.2022.10.25.02.55.52; Tue, 25 Oct 2022 02:56:06 -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 S231686AbiJYJyV (ORCPT + 99 others); Tue, 25 Oct 2022 05:54:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231608AbiJYJww (ORCPT ); Tue, 25 Oct 2022 05:52:52 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 158F0134A84; Tue, 25 Oct 2022 02:49:21 -0700 (PDT) Received: from fraeml744-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MxRvL0Zclz688yr; Tue, 25 Oct 2022 17:47:58 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml744-chm.china.huawei.com (10.206.15.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 25 Oct 2022 11:49:19 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 25 Oct 2022 10:49:14 +0100 From: John Garry To: , , , , , , , , , CC: , , , , , John Garry Subject: [PATCH RFC v3 20/22] scsi: core: Add scsi_alloc_request_hwq() Date: Tue, 25 Oct 2022 18:18:14 +0800 Message-ID: <1666693096-180008-21-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1666693096-180008-1-git-send-email-john.garry@huawei.com> References: <1666693096-180008-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747652985356577137?= X-GMAIL-MSGID: =?utf-8?q?1747652985356577137?= 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 08015c42c326..a622be13bc48 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1143,6 +1143,18 @@ struct request *scsi_alloc_request(struct request_queue *q, blk_opf_t opf, } 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 7d3622db38ed..1fd98d1e9c73 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -389,4 +389,7 @@ extern void scsi_build_sense(struct scsi_cmnd *scmd, int desc, struct request *scsi_alloc_request(struct request_queue *q, blk_opf_t opf, 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 */