All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Damien Le Moal <Damien.LeMoal@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>,
	"sagi@grimberg.me" <sagi@grimberg.me>,
	"anton.eidelman@gmail.com" <anton.eidelman@gmail.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Subject: Re: [PATCH] nvme: keep ctrl->namespaces ordered
Date: Wed, 15 Sep 2021 05:37:35 -0700	[thread overview]
Message-ID: <20210915123735.GB3778445@dhcp-10-100-145-180.wdc.com> (raw)
In-Reply-To: <DM6PR04MB708140E359AE0511803F1346E7DB9@DM6PR04MB7081.namprd04.prod.outlook.com>

On Wed, Sep 15, 2021 at 07:36:04AM +0000, Damien Le Moal wrote:
> > +static void nvme_ns_add_to_ctrl_list(struct nvme_ns *ns)
> > +{
> > +	struct nvme_ns *tmp;
> > +
> > +	list_for_each_entry_reverse(tmp, &ns->ctrl->namespaces, list) {
> > +		if (tmp->head->ns_id < ns->head->ns_id) {
> > +			list_add(&tmp->list, &ns->ctrl->namespaces);
> > +			return;
> > +		}
> > +	}
> > +
> > +	list_add_tail(&ns->list, &ns->ctrl->namespaces);
> 
> I wonder if it is worth checking that ns->head->id is not equal to the ID of the
> first NS in the list. That can only happen for a very buggy system or device,
> but that is not unheard of...

We would never be able to hit the condition of two heads with matching
NSID's. If the controller was broken and provided duplicate NSIDs in the
namespace list, this driver will just recheck the first namespace rather
than allocate a new one.

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

  reply	other threads:[~2021-09-15 12:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15  7:20 [PATCH] nvme: keep ctrl->namespaces ordered Christoph Hellwig
2021-09-15  7:36 ` Damien Le Moal
2021-09-15 12:37   ` Keith Busch [this message]
2021-09-15 13:47     ` Christoph Hellwig
2021-09-15  9:01 ` Damien Le Moal
2021-09-15 14:02 ` Keith Busch
2021-09-15 14:10 ` Keith Busch
2021-09-15 15:37 Christoph Hellwig
2021-09-15 15:46 ` Keith Busch
2021-09-15 22:00 ` Damien Le Moal
2021-09-16 16:53 ` Chaitanya Kulkarni
2021-09-19 10:03 ` Sagi Grimberg

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=20210915123735.GB3778445@dhcp-10-100-145-180.wdc.com \
    --to=kbusch@kernel.org \
    --cc=Damien.LeMoal@wdc.com \
    --cc=anton.eidelman@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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.