Commit 89bdba56 authored by Jim Harris's avatar Jim Harris
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ib21772579b94c5bcd1c518adb9d3341f4bf824f6

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466818


Reviewed-by: default avatarBroadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 97967681
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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));