[PATCH 5/6] nvme: track subsystems
Christoph Hellwig
hch at lst.de
Thu Jun 15 23:21:35 PDT 2017
On Thu, Jun 15, 2017 at 08:04:53PM +0300, Sagi Grimberg wrote:
>> +static struct nvme_subsystem *__nvme_find_subsystem(const char *subsysnqn)
>
> __nvme_find_get_subsystem?
Sure.
>> + if (!subsys)
>> + return -ENOMEM;
>> + INIT_LIST_HEAD(&subsys->ctrls);
>> + kref_init(&subsys->ref);
>> + nvme_init_subnqn(subsys, ctrl, id);
>> + mutex_init(&subsys->lock);
>
> Nit: might be nicer to allocate the subsys only if its new (in the
> else case) instead of freeing if you found a match. Maybe
> nvme_init_subsysnqn should receive the subsysnqn buffer (on stack
> here) which would be copied to the subsys->subnqn if new.
That means another huge stack buffer, and it means we'll have to do
a kmalloc under the global lock. Not the end of the world, but given
that most subsystems have a single controller anyway probably not worth
optimizing for.
More information about the Linux-nvme
mailing list