lkml.org 
[lkml]   [2022]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 06/11] scsi: core: Add scsi_alloc_request_hwq()
Date
Add a variant of scsi_alloc_request() which allocates a request for a
specific hw queue.

Signed-off-by: John Garry <john.garry@huawei.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 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
\
 
 \ /
  Last update: 2022-03-22 11:47    [W:0.159 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site