Re: [PATCH 1/4] nvmet: make the subsystem type configurable

Sagi Grimberg
2022-05-10T18:36:15Z

On 4/20/22 12:27, Hannes Reinecke wrote:
> Make the subsystem type configurable to allow for unique
> discovery subsystems by changing the subsystem type to
> 'discovery'.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/nvme/target/configfs.c | 60 +++++++++++++++++++++++++++++++++
> drivers/nvme/target/discovery.c | 2 +-
> drivers/nvme/target/nvmet.h | 1 +
> 3 files changed, 62 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
> index e44b2988759e..38b0ab9fb721 100644
> --- a/drivers/nvme/target/configfs.c
> +++ b/drivers/nvme/target/configfs.c
> @@ -834,6 +834,7 @@ static int nvmet_port_subsys_allow_link(struct config_item *parent,
> }
>
> list_add_tail(&link->entry, &port->subsystems);
> + subsys->port_count++;
> nvmet_port_disc_changed(port, subsys);
>
> up_write(&nvmet_config_sem);
> @@ -862,6 +863,7 @@ static void nvmet_port_subsys_drop_link(struct config_item *parent,
>
> found:
> list_del(&p->entry);
> + subsys->port_count--;
> nvmet_port_del_ctrls(port, subsys);
> nvmet_port_disc_changed(port, subsys);
>
> @@ -1234,6 +1236,63 @@ static ssize_t nvmet_subsys_attr_model_store(struct config_item *item,
> }
> CONFIGFS_ATTR(nvmet_subsys_, attr_model);
>
> +static const struct nvmet_type_name_map nvmet_subsys_type_map[] = {
> + { NVME_NQN_DISC, "referral" },
> + { NVME_NQN_NVME, "nvme" },
> + { NVME_NQN_CURR, "discovery" },

Didn't we agree that the internal enumeration would be different
than the content of the log page? It is just confusing reading it this
way...