Commit b46ce57e authored by Changpeng Liu's avatar Changpeng Liu Committed by Jim Harris
Browse files

example/nvme: use API to return the dlfeat.read_value



Some earlier NVMe drives don't implement Deallocate
Logical Block Feature(dlfeat) read value field, but
it can return zeroes in deallocated ranges, that's
the quirk NVME_QUIRK_READ_ZERO_AFTER_DEALLOCATE, so
here we use the API to cover earlier NVMe drives.

Change-Id: I6867618c60dd5488a5d4820d663da7f074af229c
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7525


Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent a2a82087
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -925,6 +925,7 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
	uint32_t				flags;
	char					uuid_str[SPDK_UUID_STRING_LEN];
	uint32_t				blocksize;
	enum spdk_nvme_dealloc_logical_block_read_value	dlfeat_read_value;

	cdata = spdk_nvme_ctrlr_get_data(ctrlr);
	nsdata = spdk_nvme_ns_get_data(ns);
@@ -947,9 +948,10 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
	       (flags & SPDK_NVME_NS_DEALLOCATE_SUPPORTED) ? "Supported" : "Not Supported");
	printf("Deallocated/Unwritten Error:           %s\n",
	       nsdata->nsfeat.dealloc_or_unwritten_error ? "Supported" : "Not Supported");
	dlfeat_read_value = spdk_nvme_ns_get_dealloc_logical_block_read_value(ns);
	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" :
	       dlfeat_read_value == SPDK_NVME_DEALLOC_READ_00 ? "All 0x00" :
	       dlfeat_read_value == SPDK_NVME_DEALLOC_READ_FF ? "All 0xFF" :
	       "Unknown");
	printf("Deallocate in Write Zeroes:            %s\n",
	       nsdata->dlfeat.bits.write_zero_deallocate ? "Supported" : "Not Supported");