From: Keith Busch <kbusch@meta.com>
To: <linux-block@vger.kernel.org>, <linux-nvme@lists.infradead.org>,
<hch@lst.de>
Cc: <axboe@kernel.dk>, <leonro@nvidia.com>, Keith Busch <kbusch@kernel.org>
Subject: [PATCHv2 1/7] blk-mq-dma: move the bio and bvec_iter to blk_dma_iter
Date: Sun, 20 Jul 2025 11:40:34 -0700 [thread overview]
Message-ID: <20250720184040.2402790-2-kbusch@meta.com> (raw)
In-Reply-To: <20250720184040.2402790-1-kbusch@meta.com>
From: Keith Busch <kbusch@kernel.org>
The req_iterator just happens to have a similar fields to what the dma
iterator needs, but we're not necessarily iterating a bio_vec here. Have
the dma iterator define its private fields directly. It also helps to
remove eyesores like "iter->iter.iter".
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
block/blk-mq-dma.c | 14 +++++++-------
include/linux/blk-mq-dma.h | 3 ++-
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/block/blk-mq-dma.c b/block/blk-mq-dma.c
index ad283017caef2..21da3d8941b23 100644
--- a/block/blk-mq-dma.c
+++ b/block/blk-mq-dma.c
@@ -10,7 +10,7 @@ struct phys_vec {
u32 len;
};
-static bool blk_map_iter_next(struct request *req, struct req_iterator *iter,
+static bool blk_map_iter_next(struct request *req, struct blk_dma_iter *iter,
struct phys_vec *vec)
{
unsigned int max_size;
@@ -114,7 +114,7 @@ static bool blk_rq_dma_map_iova(struct request *req, struct device *dma_dev,
if (error)
break;
mapped += vec->len;
- } while (blk_map_iter_next(req, &iter->iter, vec));
+ } while (blk_map_iter_next(req, iter, vec));
error = dma_iova_sync(dma_dev, state, 0, mapped);
if (error) {
@@ -153,8 +153,8 @@ bool blk_rq_dma_map_iter_start(struct request *req, struct device *dma_dev,
unsigned int total_len = blk_rq_payload_bytes(req);
struct phys_vec vec;
- iter->iter.bio = req->bio;
- iter->iter.iter = req->bio->bi_iter;
+ iter->bio = req->bio;
+ iter->iter = req->bio->bi_iter;
memset(&iter->p2pdma, 0, sizeof(iter->p2pdma));
iter->status = BLK_STS_OK;
@@ -162,7 +162,7 @@ bool blk_rq_dma_map_iter_start(struct request *req, struct device *dma_dev,
* Grab the first segment ASAP because we'll need it to check for P2P
* transfers.
*/
- if (!blk_map_iter_next(req, &iter->iter, &vec))
+ if (!blk_map_iter_next(req, iter, &vec))
return false;
if (IS_ENABLED(CONFIG_PCI_P2PDMA) && (req->cmd_flags & REQ_P2PDMA)) {
@@ -213,7 +213,7 @@ bool blk_rq_dma_map_iter_next(struct request *req, struct device *dma_dev,
{
struct phys_vec vec;
- if (!blk_map_iter_next(req, &iter->iter, &vec))
+ if (!blk_map_iter_next(req, iter, &vec))
return false;
if (iter->p2pdma.map == PCI_P2PDMA_MAP_BUS_ADDR)
@@ -246,7 +246,7 @@ blk_next_sg(struct scatterlist **sg, struct scatterlist *sglist)
int __blk_rq_map_sg(struct request *rq, struct scatterlist *sglist,
struct scatterlist **last_sg)
{
- struct req_iterator iter = {
+ struct blk_dma_iter iter = {
.bio = rq->bio,
};
struct phys_vec vec;
diff --git a/include/linux/blk-mq-dma.h b/include/linux/blk-mq-dma.h
index c26a01aeae006..e1c01ba1e2e58 100644
--- a/include/linux/blk-mq-dma.h
+++ b/include/linux/blk-mq-dma.h
@@ -14,7 +14,8 @@ struct blk_dma_iter {
blk_status_t status;
/* Internal to blk_rq_dma_map_iter_* */
- struct req_iterator iter;
+ struct bvec_iter iter;
+ struct bio *bio;
struct pci_p2pdma_map_state p2pdma;
};
--
2.47.1
next prev parent reply other threads:[~2025-07-20 18:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-20 18:40 [PATCHv2 0/7] blk dma iter for metadata Keith Busch
2025-07-20 18:40 ` Keith Busch [this message]
2025-07-21 7:37 ` [PATCHv2 1/7] blk-mq-dma: move the bio and bvec_iter to blk_dma_iter Christoph Hellwig
2025-07-21 7:42 ` Christoph Hellwig
2025-07-22 2:33 ` Keith Busch
2025-07-22 5:53 ` Christoph Hellwig
2025-07-20 18:40 ` [PATCHv2 2/7] blk-mq-dma: set the bvec being iterated Keith Busch
2025-07-21 7:38 ` Christoph Hellwig
2025-07-20 18:40 ` [PATCHv2 3/7] blk-mq-dma: require unmap caller provide p2p map type Keith Busch
2025-07-21 7:39 ` Christoph Hellwig
2025-07-20 18:40 ` [PATCHv2 4/7] blk-mq: remove REQ_P2PDMA flag Keith Busch
2025-07-21 7:39 ` Christoph Hellwig
2025-07-20 18:40 ` [PATCHv2 5/7] blk-mq-dma: move common dma start code to a helper Keith Busch
2025-07-21 7:40 ` Christoph Hellwig
2025-07-20 18:40 ` [PATCHv2 6/7] blk-mq-dma: add support for mapping integrity metadata Keith Busch
2025-07-20 22:51 ` kernel test robot
2025-07-21 3:18 ` kernel test robot
2025-07-21 7:46 ` Christoph Hellwig
2025-07-20 18:40 ` [PATCHv2 7/7] nvme: convert metadata mapping to dma iter Keith Busch
2025-07-21 7:50 ` Christoph Hellwig
2025-07-21 13:15 ` Keith Busch
2025-07-22 5:49 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250720184040.2402790-2-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.