[PATCHv5 2/8] blk-mq-dma: provide the bio_vec list being iterated
Christoph Hellwig
hch at lst.de
Sun Aug 10 07:07:47 PDT 2025
On Fri, Aug 08, 2025 at 08:58:20AM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch at kernel.org>
>
> This will make it easier to add different sources of the bvec table,
> like for upcoming integrity support, rather than assume to use the bio's
> bi_io_vec. It also makes iterating "special" payloads more in common
> with iterating normal payloads.
I would call the array a table (or maybe array) and not a list.
> +static struct blk_map_iter blk_rq_map_iter(struct request *rq)
> +{
> + struct bio *bio = rq->bio;
> +
> + if (rq->rq_flags & RQF_SPECIAL_PAYLOAD) {
> + return (struct blk_map_iter) {
> + .bvec = &rq->special_vec,
> + .iter = {
> + .bi_size = rq->special_vec.bv_len,
> + }
> + };
These large struct returns generate really horrible code if they aren't
inlined (although that might happen here). I also find them not very
nice to read. Any reason to just pass a pointer and initialize the
needed fields?
Also this function probably should be named blk_rq_map_iter_start or
blk_rq_map_iter_init as it only is used for the very first iteration.
More information about the Linux-nvme
mailing list