[PATCH 2/2] nvme-multipath: do not fall back to __nvme_find_path() for non-optimized paths

Sagi Grimberg sagi at grimberg.me
Tue Jul 28 02:43:16 EDT 2020


>>> When nvme_round_robin_path() finds a valid namespace we should be 
>>> using it;
>>> falling back to __nvme_find_path() for non-optimized paths will cause 
>>> the
>>> result from nvme_round_robin_path() to be ignored for non-optimized 
>>> paths.
>>>
>>> Signed-off-by: Martin Wilck <mwilck at suse.com>
>>> Signed-off-by: Hannes Reinecke <hare at suse.de>
>>> ---
>>>   drivers/nvme/host/multipath.c | 5 ++++-
>>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/nvme/host/multipath.c 
>>> b/drivers/nvme/host/multipath.c
>>> index fe8f7f123fac..97d3c19b5684 100644
>>> --- a/drivers/nvme/host/multipath.c
>>> +++ b/drivers/nvme/host/multipath.c
>>> @@ -272,8 +272,11 @@ inline struct nvme_ns *nvme_find_path(struct 
>>> nvme_ns_head *head)
>>>       struct nvme_ns *ns;
>>>       ns = srcu_dereference(head->current_path[node], &head->srcu);
>>> -    if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR && ns)
>>> +    if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR && ns) {
>>>           ns = nvme_round_robin_path(head, node, ns);
>>> +        if (ns)
>>> +            return ns;
>>> +    }
>>>       if (unlikely(!ns || !nvme_path_is_optimized(ns)))
>>>           ns = __nvme_find_path(head, node);
>>
>> Maybe instead of the early return put the following condition on else?
> 
> That depends on whether we want to have a fallback to __nvme_find_path() 
> or not. With your suggestion we would lose that; I'd rather keep it.

OK...

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>



More information about the Linux-nvme mailing list