From de6a68e03194d735fd320de16e9f8a3e517440d9 Mon Sep 17 00:00:00 2001 From: Wojciech Malikowski Date: Wed, 5 Jun 2019 09:29:22 -0400 Subject: [PATCH] examples/nvme/fio_plugin: Init VMD during spdk_fio_setup() Try to enumerate VMD devices in fio_plugin. New flag enable_vmd was added to fio config. Change-Id: I5546665719e4ef2b169d403db8bf0398e834dbc4 Signed-off-by: Wojciech Malikowski Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456992 Tested-by: SPDK CI Jenkins Reviewed-by: Paul Luse Reviewed-by: Darek Stojaczyk Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker --- examples/nvme/fio_plugin/fio_plugin.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index 08a7d1aec..5ec18ec87 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -34,6 +34,7 @@ #include "spdk/stdinc.h" #include "spdk/nvme.h" +#include "spdk/vmd.h" #include "spdk/env.h" #include "spdk/string.h" #include "spdk/log.h" @@ -69,6 +70,7 @@ struct spdk_fio_options { int apptag; int apptag_mask; char *digest_enable; + int enable_vmd; }; struct spdk_fio_request { @@ -431,6 +433,10 @@ static int spdk_fio_setup(struct thread_data *td) if (rc != 0) { SPDK_ERRLOG("Unable to spawn a thread to poll admin queues. They won't be polled.\n"); } + + if (fio_options->enable_vmd && spdk_vmd_init()) { + SPDK_ERRLOG("Failed to initialize VMD. Some NVMe devices can be unavailable.\n"); + } } for_each_file(td, f, i) { @@ -1045,6 +1051,16 @@ static struct fio_option options[] = { .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_INVALID, }, + { + .name = "enable_vmd", + .lname = "Enable VMD enumeration", + .type = FIO_OPT_INT, + .off1 = offsetof(struct spdk_fio_options, enable_vmd), + .def = "0", + .help = "Enable VMD enumeration (enable_vmd=1 or enable_vmd=0)", + .category = FIO_OPT_C_ENGINE, + .group = FIO_OPT_G_INVALID, + }, { .name = NULL, },