[PATCH] nvme: find numa distance only if controller has valid numa id
Nilay Shroff
nilay at linux.ibm.com
Mon Apr 15 00:54:47 PDT 2024
On 4/15/24 12:55, Christoph Hellwig wrote:
> On Sat, Apr 13, 2024 at 02:34:36PM +0530, Nilay Shroff wrote:
>> continue;
>>
>> - if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA)
>> - distance = node_distance(node, ns->ctrl->numa_node);
>> - else
>> - distance = LOCAL_DISTANCE;
>> + if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA) {
>> + if (ns->ctrl->numa_node != NUMA_NO_NODE)
>> + distance = node_distance(node, ns->ctrl->numa_node);
>> + }
>
> Please avoid the overly long line. This could be easily done by keeping
> the old code structure, which IMHO is more readable anyway:
>
> if (ns->ctrl->numa_node != NUMA_NO_NODE &&
> READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA)
> distance = node_distance(node, ns->ctrl->numa_node);
> else
> distance = LOCAL_DISTANCE;
>
>
Sure. I will incorporate the above comment in the next version of the patch.
Thanks,
--Nilay
More information about the Linux-nvme
mailing list