identify: print metadata type regardless of PI type

Print the type of metadata (extended LBA / separate buffer), even if
protection information is disabled. Changed the way protection
information's location is reported to be more accurate (previous
"Metadata Location" wasn't precise enough). Aligned all of the namespace
information fields, so that all values start from the same column.

Change-Id: Ia736db233cbcfdddcfd4a1437907e528f2b8947b
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459623
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Konrad Sztyber 2019-06-27 12:52:52 +02:00 committed by Ben Walker
parent d354d0a342
commit 02f147567c

View File

@ -682,85 +682,87 @@ print_namespace(struct spdk_nvme_ns *ns)
return; return;
} }
printf("Deallocate: %s\n", printf("Deallocate: %s\n",
(flags & SPDK_NVME_NS_DEALLOCATE_SUPPORTED) ? "Supported" : "Not Supported"); (flags & SPDK_NVME_NS_DEALLOCATE_SUPPORTED) ? "Supported" : "Not Supported");
printf("Deallocated/Unwritten Error: %s\n", printf("Deallocated/Unwritten Error: %s\n",
nsdata->nsfeat.dealloc_or_unwritten_error ? "Supported" : "Not Supported"); nsdata->nsfeat.dealloc_or_unwritten_error ? "Supported" : "Not Supported");
printf("Deallocated Read Value: %s\n", printf("Deallocated Read Value: %s\n",
nsdata->dlfeat.bits.read_value == SPDK_NVME_DEALLOC_READ_00 ? "All 0x00" : nsdata->dlfeat.bits.read_value == SPDK_NVME_DEALLOC_READ_00 ? "All 0x00" :
nsdata->dlfeat.bits.read_value == SPDK_NVME_DEALLOC_READ_FF ? "All 0xFF" : nsdata->dlfeat.bits.read_value == SPDK_NVME_DEALLOC_READ_FF ? "All 0xFF" :
"Unknown"); "Unknown");
printf("Deallocate in Write Zeroes: %s\n", printf("Deallocate in Write Zeroes: %s\n",
nsdata->dlfeat.bits.write_zero_deallocate ? "Supported" : "Not Supported"); nsdata->dlfeat.bits.write_zero_deallocate ? "Supported" : "Not Supported");
printf("Deallocated Guard Field: %s\n", printf("Deallocated Guard Field: %s\n",
nsdata->dlfeat.bits.guard_value ? "CRC for Read Value" : "0xFFFF"); nsdata->dlfeat.bits.guard_value ? "CRC for Read Value" : "0xFFFF");
printf("Flush: %s\n", printf("Flush: %s\n",
(flags & SPDK_NVME_NS_FLUSH_SUPPORTED) ? "Supported" : "Not Supported"); (flags & SPDK_NVME_NS_FLUSH_SUPPORTED) ? "Supported" : "Not Supported");
printf("Reservation: %s\n", printf("Reservation: %s\n",
(flags & SPDK_NVME_NS_RESERVATION_SUPPORTED) ? "Supported" : "Not Supported"); (flags & SPDK_NVME_NS_RESERVATION_SUPPORTED) ? "Supported" : "Not Supported");
if (flags & SPDK_NVME_NS_DPS_PI_SUPPORTED) { if (flags & SPDK_NVME_NS_DPS_PI_SUPPORTED) {
printf("End-to-End Data Protection: Supported\n"); printf("End-to-End Data Protection: Supported\n");
printf("Protection Type: Type%d\n", nsdata->dps.pit); printf("Protection Type: Type%d\n", nsdata->dps.pit);
printf("Metadata Transfered as: %s\n", printf("Protection Information Transferred as: %s\n",
nsdata->flbas.extended ? "Extended Data LBA" : "Separate Metadata Buffer");
printf("Metadata Location: %s\n",
nsdata->dps.md_start ? "First 8 Bytes" : "Last 8 Bytes"); nsdata->dps.md_start ? "First 8 Bytes" : "Last 8 Bytes");
} }
printf("Namespace Sharing Capabilities: %s\n", if (nsdata->lbaf[nsdata->flbas.format].ms > 0) {
printf("Metadata Transferred as: %s\n",
nsdata->flbas.extended ? "Extended Data LBA" : "Separate Metadata Buffer");
}
printf("Namespace Sharing Capabilities: %s\n",
nsdata->nmic.can_share ? "Multiple Controllers" : "Private"); nsdata->nmic.can_share ? "Multiple Controllers" : "Private");
printf("Size (in LBAs): %lld (%lldM)\n", printf("Size (in LBAs): %lld (%lldM)\n",
(long long)nsdata->nsze, (long long)nsdata->nsze,
(long long)nsdata->nsze / 1024 / 1024); (long long)nsdata->nsze / 1024 / 1024);
printf("Capacity (in LBAs): %lld (%lldM)\n", printf("Capacity (in LBAs): %lld (%lldM)\n",
(long long)nsdata->ncap, (long long)nsdata->ncap,
(long long)nsdata->ncap / 1024 / 1024); (long long)nsdata->ncap / 1024 / 1024);
printf("Utilization (in LBAs): %lld (%lldM)\n", printf("Utilization (in LBAs): %lld (%lldM)\n",
(long long)nsdata->nuse, (long long)nsdata->nuse,
(long long)nsdata->nuse / 1024 / 1024); (long long)nsdata->nuse / 1024 / 1024);
if (nsdata->noiob) { if (nsdata->noiob) {
printf("Optimal I/O Boundary: %u blocks\n", nsdata->noiob); printf("Optimal I/O Boundary: %u blocks\n", nsdata->noiob);
} }
if (!spdk_mem_all_zero(nsdata->nguid, sizeof(nsdata->nguid))) { if (!spdk_mem_all_zero(nsdata->nguid, sizeof(nsdata->nguid))) {
printf("NGUID: "); printf("NGUID: ");
print_hex_be(nsdata->nguid, sizeof(nsdata->nguid)); print_hex_be(nsdata->nguid, sizeof(nsdata->nguid));
printf("\n"); printf("\n");
} }
if (!spdk_mem_all_zero(&nsdata->eui64, sizeof(nsdata->eui64))) { if (!spdk_mem_all_zero(&nsdata->eui64, sizeof(nsdata->eui64))) {
printf("EUI64: "); printf("EUI64: ");
print_hex_be(&nsdata->eui64, sizeof(nsdata->eui64)); print_hex_be(&nsdata->eui64, sizeof(nsdata->eui64));
printf("\n"); printf("\n");
} }
uuid = spdk_nvme_ns_get_uuid(ns); uuid = spdk_nvme_ns_get_uuid(ns);
if (uuid) { if (uuid) {
spdk_uuid_fmt_lower(uuid_str, sizeof(uuid_str), uuid); spdk_uuid_fmt_lower(uuid_str, sizeof(uuid_str), uuid);
printf("UUID: %s\n", uuid_str); printf("UUID: %s\n", uuid_str);
} }
printf("Thin Provisioning: %s\n", printf("Thin Provisioning: %s\n",
nsdata->nsfeat.thin_prov ? "Supported" : "Not Supported"); nsdata->nsfeat.thin_prov ? "Supported" : "Not Supported");
printf("Per-NS Atomic Units: %s\n", printf("Per-NS Atomic Units: %s\n",
nsdata->nsfeat.ns_atomic_write_unit ? "Yes" : "No"); nsdata->nsfeat.ns_atomic_write_unit ? "Yes" : "No");
if (nsdata->nsfeat.ns_atomic_write_unit) { if (nsdata->nsfeat.ns_atomic_write_unit) {
if (nsdata->nawun) { if (nsdata->nawun) {
printf(" Atomic Write Unit (Normal): %d\n", nsdata->nawun + 1); printf(" Atomic Write Unit (Normal): %d\n", nsdata->nawun + 1);
} }
if (nsdata->nawupf) { if (nsdata->nawupf) {
printf(" Atomic Write Unit (PFail): %d\n", nsdata->nawupf + 1); printf(" Atomic Write Unit (PFail): %d\n", nsdata->nawupf + 1);
} }
if (nsdata->nacwu) { if (nsdata->nacwu) {
printf(" Atomic Compare & Write Unit: %d\n", nsdata->nacwu + 1); printf(" Atomic Compare & Write Unit: %d\n", nsdata->nacwu + 1);
} }
printf(" Atomic Boundary Size (Normal): %d\n", nsdata->nabsn); printf(" Atomic Boundary Size (Normal): %d\n", nsdata->nabsn);
printf(" Atomic Boundary Size (PFail): %d\n", nsdata->nabspf); printf(" Atomic Boundary Size (PFail): %d\n", nsdata->nabspf);
printf(" Atomic Boundary Offset: %d\n", nsdata->nabo); printf(" Atomic Boundary Offset: %d\n", nsdata->nabo);
} }
printf("NGUID/EUI64 Never Reused: %s\n", printf("NGUID/EUI64 Never Reused: %s\n",
nsdata->nsfeat.guid_never_reused ? "Yes" : "No"); nsdata->nsfeat.guid_never_reused ? "Yes" : "No");
printf("Number of LBA Formats: %d\n", nsdata->nlbaf + 1); printf("Number of LBA Formats: %d\n", nsdata->nlbaf + 1);
printf("Current LBA Format: LBA Format #%02d\n", printf("Current LBA Format: LBA Format #%02d\n",
nsdata->flbas.format); nsdata->flbas.format);
for (i = 0; i <= nsdata->nlbaf; i++) for (i = 0; i <= nsdata->nlbaf; i++)
printf("LBA Format #%02d: Data Size: %5d Metadata Size: %5d\n", printf("LBA Format #%02d: Data Size: %5d Metadata Size: %5d\n",