[PATCH V2 1/2] nvme-core: replace ctrl page size with a macro

Chaitanya Kulkarni Chaitanya.Kulkarni at wdc.com
Sat Jul 11 14:20:26 EDT 2020


On 7/10/20 07:57, Keith Busch wrote:
> This makes it sound like we'd actually trigger this bug, but we
> currently don't do that. I think the changelog should be more about why
> we can remove of 'ctrl->page_size', something like:
> 
>    Saving the nvme controller's page size was from a time when the driver
>    tried to use different sized pages, but this value is always set to
>    a constant, and has been this way for some time. Remove the
>    'page_size' field and replace its usage with the constant value.
> 
> This also lets the compiler make some micro-optimizations in the io
> path, and that's always a good thing.
> 
Sure, I felt since it is not triggered yet it make sense to document 
what actually might happen due to current code.

I'll use you log.
> 
>> @@ -1825,7 +1824,7 @@ static int nvme_set_host_mem(struct nvme_dev *dev, u32 bits)
>>   	c.features.fid		= cpu_to_le32(NVME_FEAT_HOST_MEM_BUF);
>>   	c.features.dword11	= cpu_to_le32(bits);
>>   	c.features.dword12	= cpu_to_le32(dev->host_mem_size >>
>> -					      ilog2(dev->ctrl.page_size));
>> +					      ilog2(NVME_CTRL_PAGE_SIZE));
> You could replace the ilog2() with NVME_CTRL_PAGE_SHIFT. Both compile to
> the same result, though.
> 
Make sense.

I'll send V3 shortly.




More information about the Linux-nvme mailing list