Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Aug 2019 04:02:25 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r351533 - stable/12/sbin/nvmecontrol
Message-ID:  <201908270402.x7R42Pw1000532@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Aug 27 04:02:25 2019
New Revision: 351533
URL: https://svnweb.freebsd.org/changeset/base/351533

Log:
  MFC r351038: Print few more useful identify fields.

Modified:
  stable/12/sbin/nvmecontrol/identify.c
  stable/12/sbin/nvmecontrol/identify_ext.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/nvmecontrol/identify.c
==============================================================================
--- stable/12/sbin/nvmecontrol/identify.c	Tue Aug 27 04:01:56 2019	(r351532)
+++ stable/12/sbin/nvmecontrol/identify.c	Tue Aug 27 04:02:25 2019	(r351533)
@@ -62,6 +62,7 @@ static struct options {
 void
 print_namespace(struct nvme_namespace_data *nsdata)
 {
+	char cbuf[UINT128_DIG + 1];
 	uint32_t	i;
 	uint32_t	lbaf, lbads, ms, rp;
 	uint8_t		thin_prov, ptype;
@@ -73,15 +74,12 @@ print_namespace(struct nvme_namespace_data *nsdata)
 	flbas_fmt = (nsdata->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) &
 		NVME_NS_DATA_FLBAS_FORMAT_MASK;
 
-	printf("Size (in LBAs):              %lld (%lldM)\n",
-		(long long)nsdata->nsze,
-		(long long)nsdata->nsze / 1024 / 1024);
-	printf("Capacity (in LBAs):          %lld (%lldM)\n",
-		(long long)nsdata->ncap,
-		(long long)nsdata->ncap / 1024 / 1024);
-	printf("Utilization (in LBAs):       %lld (%lldM)\n",
-		(long long)nsdata->nuse,
-		(long long)nsdata->nuse / 1024 / 1024);
+	printf("Size:                        %lld blocks\n",
+	    (long long)nsdata->nsze);
+	printf("Capacity:                    %lld blocks\n",
+	    (long long)nsdata->ncap);
+	printf("Utilization:                 %lld blocks\n",
+	    (long long)nsdata->nuse);
 	printf("Thin Provisioning:           %s\n",
 		thin_prov ? "Supported" : "Not Supported");
 	printf("Number of LBA Formats:       %d\n", nsdata->nlbaf+1);
@@ -148,7 +146,22 @@ print_namespace(struct nvme_namespace_data *nsdata)
 	     NVME_NS_DATA_DLFEAT_DWZ_MASK ? ", Write Zero" : "",
 	    (nsdata->dlfeat >> NVME_NS_DATA_DLFEAT_GCRC_SHIFT) &
 	     NVME_NS_DATA_DLFEAT_GCRC_MASK ? ", Guard CRC" : "");
-	printf("Optimal I/O Boundary (LBAs): %u\n", nsdata->noiob);
+	printf("Optimal I/O Boundary:        %u blocks\n", nsdata->noiob);
+	printf("NVM Capacity:                %s bytes\n",
+	   uint128_to_str(to128(nsdata->nvmcap), cbuf, sizeof(cbuf)));
+	if ((nsdata->nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) &
+	    NVME_NS_DATA_NSFEAT_NPVALID_MASK) {
+		printf("Preferred Write Granularity: %u blocks",
+		    nsdata->npwg + 1);
+		printf("Preferred Write Alignment:   %u blocks",
+		    nsdata->npwa + 1);
+		printf("Preferred Deallocate Granul: %u blocks",
+		    nsdata->npdg + 1);
+		printf("Preferred Deallocate Align:  %u blocks",
+		    nsdata->npda + 1);
+		printf("Optimal Write Size:          %u blocks",
+		    nsdata->nows + 1);
+	}
 	printf("Globally Unique Identifier:  ");
 	for (i = 0; i < sizeof(nsdata->nguid); i++)
 		printf("%02x", nsdata->nguid[i]);

Modified: stable/12/sbin/nvmecontrol/identify_ext.c
==============================================================================
--- stable/12/sbin/nvmecontrol/identify_ext.c	Tue Aug 27 04:01:56 2019	(r351532)
+++ stable/12/sbin/nvmecontrol/identify_ext.c	Tue Aug 27 04:02:25 2019	(r351533)
@@ -121,7 +121,7 @@ nvme_print_controller(struct nvme_controller_data *cda
 	if (cdata->mdts == 0)
 		printf("Unlimited\n");
 	else
-		printf("%ld\n", PAGE_SIZE * (1L << cdata->mdts));
+		printf("%ld bytes\n", PAGE_SIZE * (1L << cdata->mdts));
 	printf("Controller ID:               0x%04x\n", cdata->ctrlr_id);
 	printf("Version:                     %d.%d.%d\n",
 	    (cdata->ver >> 16) & 0xffff, (cdata->ver >> 8) & 0xff,
@@ -184,6 +184,14 @@ nvme_print_controller(struct nvme_controller_data *cda
 		ns_smart ? "Yes" : "No");
 	printf("Error Log Page Entries:      %d\n", cdata->elpe+1);
 	printf("Number of Power States:      %d\n", cdata->npss+1);
+	if (cdata->ver >= 0x010200) {
+		printf("Total NVM Capacity:          %s bytes\n",
+		    uint128_to_str(to128(cdata->untncap.tnvmcap),
+		    cbuf, sizeof(cbuf)));
+		printf("Unallocated NVM Capacity:    %s bytes\n",
+		    uint128_to_str(to128(cdata->untncap.unvmcap),
+		    cbuf, sizeof(cbuf)));
+	}
 
 	printf("\n");
 	printf("NVM Command Set Attributes\n");
@@ -235,13 +243,6 @@ nvme_print_controller(struct nvme_controller_data *cda
 	    (t == NVME_CTRLR_DATA_VWC_ALL_NO) ? ", no flush all" :
 	    (t == NVME_CTRLR_DATA_VWC_ALL_YES) ? ", flush all" : "");
 
-	if (nsmgmt) {
-		printf("\n");
-		printf("Namespace Drive Attributes\n");
-		printf("==========================\n");
-		printf("NVM total cap:               %s\n",
-			   uint128_to_str(to128(cdata->untncap.tnvmcap), cbuf, sizeof(cbuf)));
-		printf("NVM unallocated cap:         %s\n",
-			   uint128_to_str(to128(cdata->untncap.unvmcap), cbuf, sizeof(cbuf)));
-	}
+	if (cdata->ver >= 0x010201)
+		printf("\nNVM Subsystem Name:          %.256s\n", cdata->subnqn);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908270402.x7R42Pw1000532>