All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@meta.com>
To: <linux-block@vger.kernel.org>, <linux-nvme@lists.infradead.org>
Cc: <hch@lst.de>, <axboe@kernel.dk>, <joshi.k@samsung.com>,
	Keith Busch <kbusch@kernel.org>
Subject: [PATCHv7 1/9] blk-mq-dma: create blk_map_iter type
Date: Wed, 13 Aug 2025 08:31:45 -0700	[thread overview]
Message-ID: <20250813153153.3260897-2-kbusch@meta.com> (raw)
In-Reply-To: <20250813153153.3260897-1-kbusch@meta.com>

From: Keith Busch <kbusch@kernel.org>

The req_iterator happens to have a similar fields to what the dma
iterator needs, but we're not necessarily iterating a request's
bi_io_vec. Create a new type that can be amended for additional future
use.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-mq-dma.c         | 4 ++--
 include/linux/blk-mq-dma.h | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/block/blk-mq-dma.c b/block/blk-mq-dma.c
index ad283017caef2..51e7a0ff045f9 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_map_iter *iter,
 			      struct phys_vec *vec)
 {
 	unsigned int max_size;
@@ -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_map_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..6a7e3828673d7 100644
--- a/include/linux/blk-mq-dma.h
+++ b/include/linux/blk-mq-dma.h
@@ -5,6 +5,11 @@
 #include <linux/blk-mq.h>
 #include <linux/pci-p2pdma.h>
 
+struct blk_map_iter {
+	struct bvec_iter		iter;
+	struct bio			*bio;
+};
+
 struct blk_dma_iter {
 	/* Output address range for this iteration */
 	dma_addr_t			addr;
@@ -14,7 +19,7 @@ struct blk_dma_iter {
 	blk_status_t			status;
 
 	/* Internal to blk_rq_dma_map_iter_* */
-	struct req_iterator		iter;
+	struct blk_map_iter		iter;
 	struct pci_p2pdma_map_state	p2pdma;
 };
 
-- 
2.47.3


  reply	other threads:[~2025-08-13 15:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13 15:31 [PATCHv7 0/9] blk dma iter for integrity metadata Keith Busch
2025-08-13 15:31 ` Keith Busch [this message]
2025-08-14 10:17   ` [PATCHv7 1/9] blk-mq-dma: create blk_map_iter type Kanchan Joshi
2025-08-13 15:31 ` [PATCHv7 2/9] blk-mq-dma: provide the bio_vec array being iterated Keith Busch
2025-08-14 10:17   ` Kanchan Joshi
2025-08-13 15:31 ` [PATCHv7 3/9] blk-mq-dma: require unmap caller provide p2p map type Keith Busch
2025-08-13 15:53   ` Christoph Hellwig
2025-08-14 10:18   ` Kanchan Joshi
2025-08-13 15:31 ` [PATCHv7 4/9] blk-mq: remove REQ_P2PDMA flag Keith Busch
2025-08-13 15:53   ` Christoph Hellwig
2025-08-14 10:19   ` Kanchan Joshi
2025-08-13 15:31 ` [PATCHv7 5/9] blk-mq-dma: move common dma start code to a helper Keith Busch
2025-08-13 15:53   ` Christoph Hellwig
2025-08-14 10:19   ` Kanchan Joshi
2025-08-13 15:31 ` [PATCHv7 6/9] blk-mq-dma: add scatter-less integrity data DMA mapping Keith Busch
2025-08-13 15:55   ` Christoph Hellwig
2025-08-14 10:36   ` Kanchan Joshi
2025-08-13 15:31 ` [PATCHv7 7/9] blk-integrity: use iterator for mapping sg Keith Busch
2025-08-13 15:55   ` Christoph Hellwig
2025-08-13 16:53   ` Martin K. Petersen
2025-08-13 15:31 ` [PATCHv7 8/9] nvme-pci: create common sgl unmapping helper Keith Busch
2025-08-13 15:56   ` Christoph Hellwig
2025-08-13 15:31 ` [PATCHv7 9/9] nvme-pci: convert metadata mapping to dma iter Keith Busch
2025-08-13 16:57 ` [PATCHv7 0/9] blk dma iter for integrity metadata Martin K. Petersen
2025-08-25  7:55 ` Christoph Hellwig
2025-08-25 13:47 ` Jens Axboe

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=20250813153153.3260897-2-kbusch@meta.com \
    --to=kbusch@meta.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=joshi.k@samsung.com \
    --cc=kbusch@kernel.org \
    --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.