Commit 5e54cc4d authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf: enable dataset management based on unmap support



Rather than comparing the bdev name against "NVMe", use the new I/O type
supported API to query whether the unmap operation is supported.

Change-Id: I62c7a1ea5529366ff2ae4723b62f24ea78aa8193
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 7d7f73d0
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -63,17 +63,20 @@ static void nvmf_virtual_set_dsm(struct spdk_nvmf_subsystem *subsys)
	int i;

	for (i = 0; i < subsys->ctrlr.dev.virtual.ns_count; i++) {
		if (!strncasecmp(subsys->ctrlr.dev.virtual.ns_list[i]->name, "Nvme", 4)) {
			continue;
		} else {
			break;
		struct spdk_bdev *bdev = subsys->ctrlr.dev.virtual.ns_list[i];

		if (!spdk_bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_UNMAP)) {
			SPDK_TRACELOG(SPDK_TRACE_NVMF,
				      "Subsystem%d Namespace %s does not support unmap - not enabling DSM\n",
				      i, bdev->name);
			return;
		}
	}

	if (i == subsys->ctrlr.dev.virtual.ns_count) {
	SPDK_TRACELOG(SPDK_TRACE_NVMF, "All devices in Subsystem%d support unmap - enabling DSM\n",
		      subsys->num);
	subsys->session->vcdata.oncs.dsm = 1;
}
}

static void
nvmf_virtual_ctrlr_get_data(struct nvmf_session *session)