From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@meta.com>
Cc: hch@lst.de, linux-nvme@lists.infradead.org,
linux-block@vger.kernel.org, axboe@kernel.dk, leon@kernel.org,
joshi.k@samsung.com, sagi@grimberg.me,
Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH 2/2] nvme: convert metadata mapping to dma iter
Date: Thu, 26 Jun 2025 07:11:07 +0200 [thread overview]
Message-ID: <20250626051106.GB23248@lst.de> (raw)
In-Reply-To: <20250625204445.1802483-2-kbusch@meta.com>
On Wed, Jun 25, 2025 at 01:44:45PM -0700, Keith Busch wrote:
> static blk_status_t nvme_pci_setup_meta_sgls(struct request *req)
> {
> struct nvme_queue *nvmeq = req->mq_hctx->driver_data;
> struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
> + struct nvme_dev *dev = nvmeq->dev;
> struct nvme_sgl_desc *sg_list;
> + struct blk_dma_iter iter;
> dma_addr_t sgl_dma;
> + int i = 0;
>
> + if (!blk_rq_integrity_dma_map_iter_start(req, dev->dev, &iter))
> + return iter.status;
If blk_rq_dma_map_coalesce returns true after this, which it will do for
all mappings when using an IOMMU, we can simply set up a single contiguous
metadata pointers here, which will be a lot more efficient than using an
SGL.
> + for (i = 1; i <= iod->nr_meta_descriptors; i++)
> + dma_unmap_page(dev->dev, le64_to_cpu(sg_list[i].addr),
> + le32_to_cpu(sg_list[i].length), dir);
This should walk based on the size of SGL segment descriptor pointed to
by the metadata pointer, similar to what we do for the data SGLs. The
descriptors if counted as by the data mapping path are always one for
SGL mappings (and could in fact just be replaced with a flag if we
cared enough).
next prev parent reply other threads:[~2025-06-26 5:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 20:44 [PATCH 1/2] blk-integrity: add scatter-less DMA mapping helpers Keith Busch
2025-06-25 20:44 ` [PATCH 2/2] nvme: convert metadata mapping to dma iter Keith Busch
2025-06-25 21:18 ` Keith Busch
2025-06-26 5:11 ` Christoph Hellwig [this message]
2025-06-26 13:55 ` kernel test robot
2025-06-25 21:17 ` [PATCH 1/2] blk-integrity: add scatter-less DMA mapping helpers Keith Busch
2025-06-26 5:02 ` Christoph Hellwig
2025-06-26 13:55 ` kernel test robot
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=20250626051106.GB23248@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=joshi.k@samsung.com \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=leon@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox