[PATCH 4/5] nvme-pci: iod nents fits in s8

Keith Busch kbusch at kernel.org
Fri Jul 29 08:24:55 PDT 2022


On Fri, Jul 29, 2022 at 03:21:21PM +0200, Christoph Hellwig wrote:
> On Thu, Jul 28, 2022 at 03:11:50PM -0700, Keith Busch wrote:
> > From: Keith Busch <kbusch at kernel.org>
> > 
> > The maximum number of 'nents' allowed by the queue limit is 127, which
> > fits in an 's8'.
> > 
> > Signed-off-by: Keith Busch <kbusch at kernel.org>
> > ---
> >  drivers/nvme/host/pci.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> > index 9e5bbf4e3e07..546de3c2000b 100644
> > --- a/drivers/nvme/host/pci.c
> > +++ b/drivers/nvme/host/pci.c
> > @@ -229,7 +229,7 @@ struct nvme_iod {
> >  	bool use_sgl;
> >  	bool aborted;
> >  	s8 npages;		/* In the PRP list. 0 means small pool in use */
> > -	int nents;		/* Used in scatterlist */
> > +	s8 nents;		/* Used in scatterlist */
> 
> Can we please have a BUILD_BUG_ON to protect us from an increased
> max_segments?  As I can totally see us incrementing that at some point,
> and the limit is somewhat close.

Yes, will do. Also, this one is only ever assigned unsigned values, so I'll
make this a u8 in the next version.



More information about the Linux-nvme mailing list