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: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-08-26 09:28:15 -07:00
parent 7d7f73d064
commit 5e54cc4dba

View File

@ -63,16 +63,19 @@ 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) {
subsys->session->vcdata.oncs.dsm = 1;
}
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