From 02f147567c58d809a61d68a495af10f458df9a2a Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Thu, 27 Jun 2019 12:52:52 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459623 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Reviewed-by: Wojciech Malikowski Reviewed-by: Paul Luse Reviewed-by: Changpeng Liu --- examples/nvme/identify/identify.c | 64 ++++++++++++++++--------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/examples/nvme/identify/identify.c b/examples/nvme/identify/identify.c index 523f08981..632513e6b 100644 --- a/examples/nvme/identify/identify.c +++ b/examples/nvme/identify/identify.c @@ -682,85 +682,87 @@ print_namespace(struct spdk_nvme_ns *ns) return; } - printf("Deallocate: %s\n", + printf("Deallocate: %s\n", (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"); - 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_FF ? "All 0xFF" : "Unknown"); - printf("Deallocate in Write Zeroes: %s\n", + printf("Deallocate in Write Zeroes: %s\n", 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"); - printf("Flush: %s\n", + printf("Flush: %s\n", (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"); if (flags & SPDK_NVME_NS_DPS_PI_SUPPORTED) { - printf("End-to-End Data Protection: Supported\n"); - printf("Protection Type: Type%d\n", nsdata->dps.pit); - printf("Metadata Transfered as: %s\n", - nsdata->flbas.extended ? "Extended Data LBA" : "Separate Metadata Buffer"); - printf("Metadata Location: %s\n", + printf("End-to-End Data Protection: Supported\n"); + printf("Protection Type: Type%d\n", nsdata->dps.pit); + printf("Protection Information Transferred as: %s\n", 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"); - printf("Size (in LBAs): %lld (%lldM)\n", + printf("Size (in LBAs): %lld (%lldM)\n", (long long)nsdata->nsze, (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 / 1024 / 1024); - printf("Utilization (in LBAs): %lld (%lldM)\n", + printf("Utilization (in LBAs): %lld (%lldM)\n", (long long)nsdata->nuse, (long long)nsdata->nuse / 1024 / 1024); 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))) { - printf("NGUID: "); + printf("NGUID: "); print_hex_be(nsdata->nguid, sizeof(nsdata->nguid)); printf("\n"); } if (!spdk_mem_all_zero(&nsdata->eui64, sizeof(nsdata->eui64))) { - printf("EUI64: "); + printf("EUI64: "); print_hex_be(&nsdata->eui64, sizeof(nsdata->eui64)); printf("\n"); } uuid = spdk_nvme_ns_get_uuid(ns); if (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"); - printf("Per-NS Atomic Units: %s\n", + printf("Per-NS Atomic Units: %s\n", nsdata->nsfeat.ns_atomic_write_unit ? "Yes" : "No"); if (nsdata->nsfeat.ns_atomic_write_unit) { 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) { - printf(" Atomic Write Unit (PFail): %d\n", nsdata->nawupf + 1); + printf(" Atomic Write Unit (PFail): %d\n", nsdata->nawupf + 1); } 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 (PFail): %d\n", nsdata->nabspf); - printf(" Atomic Boundary Offset: %d\n", nsdata->nabo); + printf(" Atomic Boundary Size (Normal): %d\n", nsdata->nabsn); + printf(" Atomic Boundary Size (PFail): %d\n", nsdata->nabspf); + 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"); - printf("Number of LBA Formats: %d\n", nsdata->nlbaf + 1); - printf("Current LBA Format: LBA Format #%02d\n", + printf("Number of LBA Formats: %d\n", nsdata->nlbaf + 1); + printf("Current LBA Format: LBA Format #%02d\n", nsdata->flbas.format); for (i = 0; i <= nsdata->nlbaf; i++) printf("LBA Format #%02d: Data Size: %5d Metadata Size: %5d\n",