fio_plugin: make spdk_env_init only once

This patch will be prepare to support multi threads.

Change-Id: I2234ae1d564c9cf17b92c85fd0a414adaa639bf2
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Ziye Yang 2017-04-20 13:19:05 +08:00 committed by Jim Harris
parent 13fc774bf4
commit da06e2ea03

View File

@ -50,6 +50,8 @@
#define MAX_LCORE_COUNT 63
bool spdk_env_initialized;
struct spdk_fio_request {
struct io_u *io;
@ -208,10 +210,13 @@ static int spdk_fio_setup(struct thread_data *td)
fio_thread->iocq = calloc(fio_thread->iocq_size, sizeof(struct io_u *));
assert(fio_thread->iocq != NULL);
spdk_env_opts_init(&opts);
opts.name = "fio";
opts.dpdk_mem_size = 512;
spdk_env_init(&opts);
if (!spdk_env_initialized) {
spdk_env_opts_init(&opts);
opts.name = "fio";
opts.dpdk_mem_size = 512;
spdk_env_init(&opts);
spdk_env_initialized = true;
}
for_each_file(td, f, i) {
memset(&trid, 0, sizeof(trid));