[PATCHv2 6/7] blk-mq-dma: add support for mapping integrity metadata
Christoph Hellwig
hch at lst.de
Mon Jul 21 00:46:58 PDT 2025
On Sun, Jul 20, 2025 at 11:40:39AM -0700, Keith Busch wrote:
> +static bool blk_dma_iter_next(struct blk_dma_iter *iter)
This is at the blk_map_iter level and one level below dma, so it
should not have a dma in the name. I'm not entirely sure what a good
name is, though. Maybe blk_map_iter_next_bio wich was the original
intention behind the refactored loop, although it isn't quite true
with the later !iter->iter.bi_bvec_done addition.
> +#ifdef CONFIG_BLK_DEV_INTEGRITY
> +bool blk_rq_integrity_dma_map_iter_start(struct request *req,
> + struct device *dma_dev, struct dma_iova_state *state,
> + struct blk_dma_iter *iter)
> +{
> + unsigned len = bio_integrity_bytes(&req->q->limits.integrity,
> + blk_rq_sectors(req));
> + iter->iter = req->bio->bi_integrity->bip_iter;
> + iter->bvec = req->bio->bi_integrity->bip_vec;
> + iter->integrity = true;
> + return blk_dma_map_iter_start(req, dma_dev, state, iter, len);
> +}
> +EXPORT_SYMBOL_GPL(blk_rq_integrity_dma_map_iter_start);
> +
> +bool blk_rq_integrity_dma_map_iter_next(struct request *req,
> + struct device *dma_dev, struct blk_dma_iter *iter)
The wans kernel doc comments that can be mostly copy and pasted
from the data mapping version.
Also it would be great to convert the integrity sg mapping and
count macros to blk_dma_map_iter_ just like I did for the data
version.
> +bool blk_rq_integrity_dma_map_iter_start(struct request *req,
> + struct device *dma_dev, struct dma_iova_state *state,
> + struct blk_dma_iter *iter)
> +{
> + return false;
> +}
> +bool blk_rq_integrity_dma_map_iter_next(struct request *req,
As you've probably noticed from the buildbot these need to be inline.
> @@ -18,6 +18,7 @@ struct blk_dma_iter {
> struct bvec_iter iter;
> struct bio *bio;
> struct pci_p2pdma_map_state p2pdma;
> + bool integrity;
Add an is_ prefix for the new field? Or replace it with checks
for ->bvec (or ->bvec_table as it should be) != bio->bi_io_vec?
More information about the Linux-nvme
mailing list