nvme: Initialize ns->ana_state when constructing ns before checking if ANA is supported

The next patch will add an new controller option, disable_read_ana_log_page.
Initializing ns->ana_state to optimized before reading ANA log page
will simplify the next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I34e56a2b454e4c02e1899f972e0ad675f2ebe2a2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8312
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Shuhei Matsumoto 2021-06-09 19:45:06 +09:00 committed by Tomasz Zawadzki
parent 072f2d0011
commit 793119f08c
2 changed files with 2 additions and 6 deletions

View File

@ -797,12 +797,6 @@ nvme_ctrlr_set_supported_log_pages(struct spdk_nvme_ctrlr *ctrlr)
nvme_ctrlr_parse_ana_log_page(ctrlr, nvme_ctrlr_update_ns_ana_states,
ctrlr);
}
} else {
uint32_t i;
for (i = 0; i < ctrlr->num_ns; i++) {
ctrlr->ns[i].ana_state = SPDK_NVME_ANA_OPTIMIZED_STATE;
}
}
out:

View File

@ -529,6 +529,8 @@ int nvme_ns_construct(struct spdk_nvme_ns *ns, uint32_t id,
ns->ctrlr = ctrlr;
ns->id = id;
/* This will be overwritten when reading ANA log page. */
ns->ana_state = SPDK_NVME_ANA_OPTIMIZED_STATE;
rc = nvme_ctrlr_identify_ns(ns);
if (rc != 0) {