[PATCH 5/9] nvme-pci: merge the simple PRP and SGL setup into a common helper
Christoph Hellwig
hch at lst.de
Wed Jun 11 22:01:42 PDT 2025
On Wed, Jun 11, 2025 at 03:03:35PM -0600, Keith Busch wrote:
> On Tue, Jun 10, 2025 at 07:06:43AM +0200, Christoph Hellwig wrote:
> > - iod->dma_len = bv->bv_len;
> > + iod->cmd.common.dptr.prp1 = cpu_to_le64(dma_addr);
> > + iod->cmd.common.dptr.prp2 = 0;
> > + if (bv.bv_len > first_prp_len)
> > + iod->cmd.common.dptr.prp2 =
> > + cpu_to_le64(dma_addr + first_prp_len);
>
> Nit, set prp2 to 0 in an 'else' case instead of unconditionally before
> overwriting it?
unconditionally setting it actually generates slightly better code,
assuming the compiler won't just optimize the other form to it anyway.
But if you think it is more readable I can change it around.
More information about the Linux-nvme
mailing list