Re: [PATCH 16/19] nvme-multipath: add nvme_mpath_{add,delete}_ns()

John Garry
2026-03-02T15:59:45Z

On 02/03/2026 12:48, Nilay Shroff wrote:
>> +void nvme_mpath_add_ns(struct nvme_ns *ns)
>> +{
>> +    struct nvme_ns_head *head = ns->head;
>> +    struct mpath_disk *mpath_disk = head->mpath_disk;
>> +    struct mpath_head *mpath_head;
>> +
>> +    if (!mpath_disk)
>> +        return;
>> +
>> +    mpath_head = mpath_disk->mpath_head;
>> +
>> +    ns->mpath_device.disk = ns->disk;
>> +    mpath_add_device(mpath_head, &ns->mpath_device);
>> +}
>
> As we have now reference to mpath_device from struct nvme_ns
> then why do we still maintain reference to ns->disk? We may
> want to directly access path device disk using ns->mpath_device.disk,
> makes sense?

For !CONFIG_NVME_MULTIPATH or !multipath mod param set, mpath_device is
not properly maintained, so I would rather not use it in the core code.

Thanks,
John