All of lore.kernel.org
 help / color / mirror / Atom feed
From: guanjx09@163.com (Guan Junxiong)
Subject: [PATCH 3/5] nvmet: Add ANA base support
Date: Sun, 6 May 2018 10:42:38 +0800	[thread overview]
Message-ID: <27413a13-850b-2226-001b-4d28904950cc@163.com> (raw)
In-Reply-To: <20180504112845.38820-4-hare@suse.de>

Hi Hannes,


On Friday, May 04, 2018 07:28 PM, Hannes Reinecke wrote:
> Add ANA support to the nvme target. The ANA configuration is optional,
> and doesn't interfere with existing configurations.
> Each subsystem has distinct ANA groups; if ANA groups are created
> it is required to link the ANA groups into the individual ports.
> Linking the entire subsystem will be refused if ANA groups are
> specified.
> Also this implementation has a limit of one single ANA state per
> groups, irrespective of the path. So when distinct ANA states
> are required one needs to create different ANA groups.
>
> Signed-off-by: Hannes Reinecke <hare at suse.com>
> ---
>
>
> +
> +static void nvmet_port_ags_drop_link(struct config_item *parent,
> +		struct config_item *target)
> +{
> +	struct nvmet_port *port = to_nvmet_port(parent->ci_parent);
> +	struct nvmet_ag *ag = to_nvmet_ag(target);
> +	struct nvmet_subsys *subsys = ag->subsys;
> +	struct nvmet_ag_link *p;
> +	int ana_active = 0;
> +
> +	down_write(&nvmet_config_sem);
> +	list_for_each_entry(p, &port->ags, entry) {
> +		if (p->ag == ag)
> +			goto found;
> +	}
> +	up_write(&nvmet_config_sem);
> +	return;
> +
> +found:
> +	list_del(&p->entry);
> +	list_del(&p->ag_list);
> +	nvmet_genctr++;
Why not nvmet_genctrl-- when dropping link?

> +
> +
> +static struct config_group *nvmet_ag_make(struct config_group *group,
> +		const char *name)
> +{
> +	struct nvmet_subsys *subsys = ag_to_subsys(&group->cg_item);
> +	struct nvmet_ag *ag, *a;
> +	int ret;
> +	u32 agid;
> +
> +	ret = kstrtou32(name, 0, &agid);
> +	if (ret)
> +		goto out;
> +
> +	ret = -EINVAL;
> +	if (agid == 0)
> +		goto out;
> +	ret = -ENOMEM;
> +	ag = nvmet_ag_alloc(subsys, agid);
> +	if (!ag)
> +		goto out;
> +	ret = -EEXIST;
> +	down_write(&nvmet_config_sem);
> +	list_for_each_entry_rcu(a, &subsys->ana_groups, entry) {
> +		if (a->grpid == agid) {
> +			nvmet_ag_free(ag);
> +			goto out;
> +		}
> +	}
> +	list_add_tail(&ag->entry, &subsys->ana_groups);
> +	up_write(&nvmet_config_sem);
> +	config_group_init_type_name(&ag->group, name, &nvmet_ag_type);
> +
> +	pr_info("adding ana groupid %d to subsystem %s\n",
> +		agid, subsys->subsysnqn);
> +	return &ag->group;
> +out:
Here should be added:? up_write(&nvmet_config_sem);
> +	return ERR_PTR(ret);


> +}
> +
> +static struct configfs_group_operations nvmet_ana_group_group_ops = {
> +	.make_group		= nvmet_ag_make,
I guess we should add :
??????????????? .drop_item? = nvmet_ag_drop,

to implement rmdir operation .



Regards

Guan Junxiong

  reply	other threads:[~2018-05-06  2:42 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 11:28 [RFC PATCH 0/5] nvme: ANA support Hannes Reinecke
2018-05-04 11:28 ` [PATCH 1/5] nvmet: EUI64 support Hannes Reinecke
2018-05-07  7:17   ` Johannes Thumshirn
2018-05-09  7:08   ` Christoph Hellwig
2018-05-09  7:45     ` Hannes Reinecke
2018-05-09  7:52       ` Christoph Hellwig
2018-05-09 15:43   ` Ewan D. Milne
2018-05-04 11:28 ` [PATCH 2/5] nvme: Add ANA base definitions Hannes Reinecke
2018-05-04 16:17   ` Keith Busch
2018-05-04 17:03     ` Meneghini, John
2018-05-04 17:21       ` Knight, Frederick
2018-05-05 13:17       ` Hannes Reinecke
2018-05-04 21:12   ` Schremmer, Steven
2018-05-09  7:27   ` Christoph Hellwig
2018-05-04 11:28 ` [PATCH 3/5] nvmet: Add ANA base support Hannes Reinecke
2018-05-06  2:42   ` Guan Junxiong [this message]
2018-05-04 11:28 ` [PATCH 4/5] block: BLK_STS_NEXUS is a path failure Hannes Reinecke
2018-05-09  7:31   ` Christoph Hellwig
2018-05-04 11:28 ` [PATCH 5/5] nvme: ANA base support Hannes Reinecke
2018-05-04 22:11   ` Schremmer, Steven
2018-05-05 13:23     ` Hannes Reinecke
2018-05-06  3:23   ` Guan Junxiong
2018-05-07  7:21   ` Johannes Thumshirn
2018-05-09 18:49   ` Ewan D. Milne
2018-05-09 19:03   ` Ewan D. Milne
2018-05-10  9:16     ` Sriram Popuri
     [not found]     ` <CAGYjvj0Mk0MFAfUEApOOyQ9Prm3CvGcZH14PJzDQT2+Qc+w81w@mail.gmail.com>
2018-05-10 13:40       ` Hannes Reinecke
2018-05-11  7:50       ` Hannes Reinecke
2018-05-11  8:22         ` Popuri, Sriram
2018-05-11  8:36           ` Popuri, Sriram
2018-05-11 16:24             ` Knight, Frederick
2018-05-12 13:31   ` Christoph Hellwig
2018-05-13 10:33     ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27413a13-850b-2226-001b-4d28904950cc@163.com \
    --to=guanjx09@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.