[PATCHv5 2/8] blk-mq-dma: provide the bio_vec list being iterated

Keith Busch kbusch at kernel.org
Mon Aug 11 10:04:26 PDT 2025


On Sun, Aug 10, 2025 at 04:07:47PM +0200, Christoph Hellwig wrote:
> On Fri, Aug 08, 2025 at 08:58:20AM -0700, Keith Busch wrote:
> > +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?

I initially set out to make a macro, inpsired by other block iterator
setups like "bvec_iter_bvec", but I thought the extra cases to handle
was better implemented as an inline function. I am definitely counting
on this being inlined to produce good code, so I should have annotated
that. No problem with switching to take a pointer, but I doubt the
resulting assembly is better either way.



More information about the Linux-nvme mailing list