Re: [RFC PATCHv5 2/7] nvme-multipath: add support for adaptive I/O policy

Guixin Liu <[email protected]> Fri, 31 Jul 2026 10:48:21 +0800
Newsgroups org.infradead.lists.linux-nvme
Message-ID <[email protected]>

在 2026/7/30 20:01, Nilay Shroff 写道:
> On 7/29/26 1:25 PM, Guixin Liu wrote:
>> Hi,
>>    Raise some comments to see if we can keep moving this
>> feature forward.
>>    Once this feature is merged, I'll be able to build the
>> service-time I/O policy on top of it.
>>
> Thanks for the review! BTW we alreday have patch revision v6
> upstream now. You may find it here (in case you missed it):
> https://lore.kernel.org/all/[email protected]/
>
Sorry, I miss that.
>>
>> +static bool nvme_mpath_enable_adaptive_path_policy(struct nvme_ns *ns)
>> +{
>> +    struct nvme_ns_head *head = ns->head;
>> +
>> +    if (!head->disk || head->subsys->iopolicy != 
>> NVME_IOPOLICY_ADAPTIVE)
>> +        return false;
>> +
>> +    if (test_and_set_bit(NVME_NS_PATH_STAT, &ns->flags))
>> +        return false;
>> +
>> +    blk_queue_flag_set(QUEUE_FLAG_SAME_FORCE, ns->queue);
>> +    blk_stat_enable_accounting(ns->queue);
>> +    return true;
>> +}
>> +
>> +static bool nvme_mpath_disable_adaptive_path_policy(struct nvme_ns *ns)
>> +{
>> +
>> +    if (!test_and_clear_bit(NVME_NS_PATH_STAT, &ns->flags))
>> +        return false;
>> +
>> +    blk_stat_disable_accounting(ns->queue);
>> +    blk_queue_flag_clear(QUEUE_FLAG_SAME_FORCE, ns->queue);
>> +    nvme_mpath_reset_adaptive_path_stat(ns);
>> The adp_path still hold the ns's pointer, should clear too,
>> otherwise, we will access a freed ns.
Is this correct?

Best Regards,
Guixin Liu
>>> +    return true;
>>> +}