Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: kbusch@kernel.org, linux-nvme@lists.infradead.org, hch@lst.de,
	willy@infradead.org, sagi@grimberg.me
Subject: Re: [PATCH V3 10/10] nvmet: use xarray for ctrl ns storing
Date: Wed, 15 Jul 2020 09:10:27 +0200	[thread overview]
Message-ID: <20200715071027.GB22320@lst.de> (raw)
In-Reply-To: <20200714233057.10915-11-chaitanya.kulkarni@wdc.com>

> index 9cdc39c8b729..2908acc7b1e2 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -115,13 +115,14 @@ u16 nvmet_zero_sgl(struct nvmet_req *req, off_t off, size_t len)
>  
>  static unsigned int nvmet_max_nsid(struct nvmet_subsys *subsys)
>  {
> -	struct nvmet_ns *ns;
> +	unsigned long nsid = 0;
> +	struct nvmet_ns *cur;
> +	unsigned long idx;
>  
> -	if (list_empty(&subsys->namespaces))
> -		return 0;
> +	xa_for_each(&subsys->namespaces, idx, cur)
> +		nsid = cur->nsid;
>  
> -	ns = list_last_entry(&subsys->namespaces, struct nvmet_ns, dev_link);
> -	return ns->nsid;
> +	return nsid;
>  }

If Matthew wants to add a helper to return the highest id for an xarray
this would be the place to use it.


> +	ret = xa_insert(&subsys->namespaces, ns->nsid, ns, GFP_KERNEL);
> +	if (ret)
> +		goto out_dev_put;

I don't think out_dev_put is enough here as that fails to tear down
ns->ref.


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2020-07-15  7:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 23:30 [PATCH V3 00/10] nvme: use xarray for ns tracking Chaitanya Kulkarni
2020-07-14 23:30 ` [PATCH V3 01/10] xarray: add __xa_load() version Chaitanya Kulkarni
2020-07-15  0:46   ` Keith Busch
2020-07-15  0:47     ` Chaitanya Kulkarni
2020-07-14 23:30 ` [PATCH V3 02/10] nvme-core: use xarray for ctrl ns tracking Chaitanya Kulkarni
2020-07-15  0:55   ` Keith Busch
2020-07-15  1:33     ` Matthew Wilcox
2020-07-15  1:41       ` Keith Busch
2020-07-15  5:12         ` Chaitanya Kulkarni
2020-07-14 23:30 ` [PATCH V3 03/10] nvme: centralize queue action nvme_kill_queues() Chaitanya Kulkarni
2020-07-15  1:36   ` Keith Busch
2020-07-15  1:39     ` Matthew Wilcox
2020-07-15  7:11   ` Christoph Hellwig
2020-07-14 23:30 ` [PATCH V3 04/10] nvme: centralize queue action nvme_unfreeze() Chaitanya Kulkarni
2020-07-14 23:30 ` [PATCH V3 05/10] nvme: centralize queue action nvme_wait_freeze() Chaitanya Kulkarni
2020-07-14 23:30 ` [PATCH V3 06/10] nvme: centralize queue action nvme_start_freeze() Chaitanya Kulkarni
2020-07-14 23:30 ` [PATCH V3 07/10] nvme: centralize queue action nvme_stop_queues() Chaitanya Kulkarni
2020-07-14 23:30 ` [PATCH V3 08/10] nvme: centralize queue action nvme_start_queues() Chaitanya Kulkarni
2020-07-14 23:30 ` [PATCH V3 09/10] nvme: centralize queue action nvme_sync_queues() Chaitanya Kulkarni
2020-07-14 23:30 ` [PATCH V3 10/10] nvmet: use xarray for ctrl ns storing Chaitanya Kulkarni
2020-07-15  7:10   ` Christoph Hellwig [this message]
2020-07-17  1:52     ` Chaitanya Kulkarni
2020-07-15  7:03 ` [PATCH V3 00/10] nvme: use xarray for ns tracking Christoph Hellwig
2020-07-16  1:48   ` Chaitanya Kulkarni
2020-07-17  2:02   ` Chaitanya Kulkarni

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=20200715071027.GB22320@lst.de \
    --to=hch@lst.de \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=willy@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox