[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1666693096-180008-21-git-send-email-john.garry@huawei.com>
Date: Tue, 25 Oct 2022 18:18:14 +0800
From: John Garry <john.garry@...wei.com>
To: <axboe@...nel.dk>, <damien.lemoal@...nsource.wdc.com>,
<jejb@...ux.ibm.com>, <martin.petersen@...cle.com>,
<jinpu.wang@...ud.ionos.com>, <hare@...e.de>, <bvanassche@....org>,
<hch@....de>, <ming.lei@...hat.com>, <niklas.cassel@....com>
CC: <linux-block@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-ide@...r.kernel.org>, <linux-scsi@...r.kernel.org>,
<linuxarm@...wei.com>, John Garry <john.garry@...wei.com>
Subject: [PATCH RFC v3 20/22] scsi: core: Add scsi_alloc_request_hwq()
Add a variant of scsi_alloc_request() which allocates a request for a
specific hw queue.
Signed-off-by: John Garry <john.garry@...wei.com>
---
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 */
--
2.35.3
Powered by blists - more mailing lists