From: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
To: Christoph Hellwig <hch@lst.de>,
"willy@infradead.org" <willy@infradead.org>
Cc: "kbusch@kernel.org" <kbusch@kernel.org>,
"sagi@grimberg.me" <sagi@grimberg.me>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Subject: Re: [PATCH V3 10/10] nvmet: use xarray for ctrl ns storing
Date: Fri, 17 Jul 2020 01:52:52 +0000 [thread overview]
Message-ID: <BYAPR04MB49653635113B5EA26861EACD867C0@BYAPR04MB4965.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20200715071027.GB22320@lst.de
On 7/15/20 00:10, Christoph Hellwig wrote:
>> 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.
>
Matthew, any suggestions on how to add a helper for above use case ?
we want to get the highest possible available index for in the XArray.
>
>> + ret = xa_insert(&subsys->namespaces, ns->nsid, ns, GFP_KERNEL);
>> + if (ret)
>> + goto out_dev_put;
>
Christoph,
> I don't think out_dev_put is enough here as that fails to tear down
> ns->ref.
>
Yes the call to percpu_ref_exit() is missing here, also it needs to
restore the subsys->max_nsid when xa_insert() fails (correct me if I'm
wrong), will add it to V4.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2020-07-17 1:53 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
2020-07-17 1:52 ` Chaitanya Kulkarni [this message]
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=BYAPR04MB49653635113B5EA26861EACD867C0@BYAPR04MB4965.namprd04.prod.outlook.com \
--to=chaitanya.kulkarni@wdc.com \
--cc=hch@lst.de \
--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;
as well as URLs for NNTP newsgroup(s).