nvme/identify: clarify total and active namespaces

As SSDs with namespace management become more prevalant,
improve the identify utility to clarify things like the
total number of namespaces, and that data is printed out
for active namespaces only.

While here, change an active namespace check to an
assert.  The print_namespace() function is only
called for active namespaces, so the check and print
was a bit confusing since it is never seen with SSDs
with inactive namespaces.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib21772579b94c5bcd1c518adb9d3341f4bf824f6

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466818
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2019-08-29 09:45:06 -07:00
parent 9796768132
commit 89bdba564a

View File

@ -680,10 +680,8 @@ print_namespace(struct spdk_nvme_ns *ns)
printf("\n");
}
if (!spdk_nvme_ns_is_active(ns)) {
printf("Inactive namespace ID\n\n");
return;
}
/* This function is only called for active namespaces. */
assert(spdk_nvme_ns_is_active(ns));
printf("Deallocate: %s\n",
(flags & SPDK_NVME_NS_DEALLOCATE_SUPPORTED) ? "Supported" : "Not Supported");
@ -964,6 +962,7 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
} else {
printf("%" PRIu64 "\n", (uint64_t)1 << (12 + cap.bits.mpsmin + cdata->mdts));
}
printf("Max Number of Namespaces: %d\n", cdata->nn);
if (features[SPDK_NVME_FEAT_ERROR_RECOVERY].valid) {
unsigned tler = features[SPDK_NVME_FEAT_ERROR_RECOVERY].result & 0xFFFF;
printf("Error Recovery Timeout: ");
@ -1561,6 +1560,8 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
printf("\n");
}
printf("Active Namespaces\n");
printf("=================\n");
for (nsid = spdk_nvme_ctrlr_get_first_active_ns(ctrlr);
nsid != 0; nsid = spdk_nvme_ctrlr_get_next_active_ns(ctrlr, nsid)) {
print_namespace(spdk_nvme_ctrlr_get_ns(ctrlr, nsid));