[PATCH RFC] nvme-pci: remove the unsed code in alloc_size

Christoph Hellwig hch at lst.de
Tue Jul 7 04:46:59 EDT 2020


On Mon, Jul 06, 2020 at 03:53:05PM -0700, Chaitanya Kulkarni wrote:
> >From the initial implementation of NVMe SGL kernel support
> commit a7a7cbe353a5 ("nvme-pci: add SGL support") with addition of the
> commit 943e942e6266 ("nvme-pci: limit max IO size and segments to avoid
> high order allocations") now there is only caller left for
> nvme_pci_iod_alloc_size() which statically passes true for last
> parameter that calculates allocation size based on SGL since we need
> size of biggest command supported for mempool allocation.
> 
> This patch removes the helper functions nvme_pci_iod_alloc_size() and
> nvme_npages() used for allocation size calculation and open codes it
> into nvme_probe().

This is an obviously correct transformation, but I think the existing
code is a land mine.  I think we should change it to use the maximum
of either the PRP or SGL case to gurantee that we are on the safe
side.  Can you do that instead?



More information about the Linux-nvme mailing list