[PATCH 3/5] nvme: refactor namespace probing
Kanchan Joshi
joshi.k at samsung.com
Wed Jul 13 03:17:00 PDT 2022
On Wed, Jul 13, 2022 at 07:49:12AM +0200, Christoph Hellwig wrote:
> static void nvme_scan_ns(struct nvme_ctrl *ctrl, unsigned nsid)
> {
>- struct nvme_ns_ids ids = { };
>- struct nvme_id_ns_cs_indep *id;
>+ struct nvme_ns_info info = { .nsid = nsid };
> struct nvme_ns *ns;
>- bool ready = true;
>
>- if (nvme_identify_ns_descs(ctrl, nsid, &ids))
>+ if (nvme_identify_ns_descs(ctrl, &info))
> return;
>
>- if (ids.csi != NVME_CSI_NVM && !nvme_multi_css(ctrl)) {
>+ if (info.ids.csi != NVME_CSI_NVM && !nvme_multi_css(ctrl)) {
> dev_warn(ctrl->device,
> "command set not reported for nsid: %d\n", nsid);
> return;
> }
>
> /*
>- * Check if the namespace is ready. If not ignore it, we will get an
>- * AEN once it becomes ready and restart the scan.
>+ * If available try to use the Command Set Idependent Identify Namespace
>+ * data structure to find all the generic information that is needed to
>+ * set up a namespace. If not fall back to the legacy version.
> */
>- if ((ctrl->cap & NVME_CAP_CRMS_CRIMS) &&
>- !nvme_identify_ns_cs_indep(ctrl, nsid, &id)) {
>- ready = id->nstat & NVME_NSTAT_NRDY;
>- kfree(id);
>+ if (ctrl->cap & NVME_CAP_CRMS_CRIMS) {
>+ if (nvme_ns_info_from_id_cs_indep(ctrl, &info))
>+ return;
Is this return fine if independent id-ns fails? Earlier behavior was to
ingore such failure.
More information about the Linux-nvme
mailing list