[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170605053825.GE19480@lst.de>
Date: Mon, 5 Jun 2017 07:38:27 +0200
From: Christoph Hellwig <hch@....de>
To: Johannes Thumshirn <jthumshirn@...e.de>
Cc: Christoph Hellwig <hch@....de>, Sagi Grimberg <sagi@...mberg.me>,
Keith Busch <keith.busch@...el.com>,
Hannes Reinecke <hare@...e.de>, maxg@...lanox.com,
Linux NVMe Mailinglist <linux-nvme@...ts.infradead.org>,
Linux Kernel Mailinglist <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 5/8] nvme: get list of namespace descriptors
> + }
> + len = NVME_NIDT_UUID_LEN;
> + memcpy(ns->uuid, data + pos + sizeof(*cur), len);
> + break;
> + default:
> + dev_warn(ns->ctrl->dev,
> + "Invalid Namespace Identification Descriptor Type: %d\n",
> + cur->nidt);
> + return;
Please drop the warning and return, the spec says hosts should ignore
unknown types. This is important to future proof for new types that
could be added.
> +static int nvme_identify_ns_descs(struct nvme_ns *ns, unsigned nsid)
> +{
> + struct nvme_command c = { };
> + int status;
> + void *data;
> +
> + c.identify.opcode = nvme_admin_identify;
> + c.identify.nsid = cpu_to_le32(nsid);
> + c.identify.cns = NVME_ID_CNS_NS_DESC_LIST;
> +
> + data = kzalloc(NVME_IDENTIFY_DATA_SIZE, GFP_KERNEL);
> + if (!data)
> + return -ENOMEM;
> +
> + status = nvme_submit_sync_cmd(ns->ctrl->admin_q, &c, data,
> + NVME_IDENTIFY_DATA_SIZE);
> + if (status)
> + goto free_data;
> +
> + nvme_parse_ns_descs(ns, data);
Just merge nvme_parse_ns_descs into the caller?
Powered by blists - more mailing lists