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 <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456992
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Wojciech Malikowski 2019-06-05 09:29:22 -04:00 committed by Darek Stojaczyk
parent 8b29e8bc7f
commit de6a68e031

View File

@ -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,
},