[PATCH V3] nvme: enable char device per namespace

Javier González javier at javigon.com
Wed Dec 16 03:01:51 EST 2020


> On 15 Dec 2020, at 23.46, Keith Busch <kbusch at kernel.org> wrote:
> 
> On Tue, Dec 15, 2020 at 08:55:57PM +0100, javier at javigon.com wrote:
>> +static int nvme_alloc_chardev_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns)
>> +{
>> +    char cdisk_name[DISK_NAME_LEN];
>> +    int ret;
>> +
>> +    device_initialize(&ns->cdev_device);
>> +    ns->cdev_device.devt = MKDEV(MAJOR(nvme_ns_base_chr_devt),
>> +                     ns->head->instance);
> 
> Ah, I see now. We are making these generic handles for each path, but
> the ns->head->instance is the same for all paths to a namespace, so it's
> not unique for that. Further, that head->instance is allocated per
> subsystem, so it's not unique from namespace heads seen in other
> subsystems.
> 
> So, I think you need to allocate a new dev_t for each subsystem rather
> than the global nvme_ns_base_chr_devt, and I guess we also need a new
> nvme_ns instance field assigned from yet another ida?

Ok. I’ll look into it. 

Thanks!


More information about the Linux-nvme mailing list