fio_plugin: add persistent fio_thread for spdk init/finish
This patch also replaces "temporary" SPDK threads for init/finish with a single persistent thread that's created at the time of init, and destroyed at the time of finish. Change-Id: I6da922cb50f06a9c31e22817d06c5dcbf19255b6 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/386247 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
8865e0bf51
commit
a658245f40
@ -285,9 +285,6 @@ spdk_fio_init_env(struct thread_data *td)
|
||||
count = spdk_fio_poll_thread(fio_thread);
|
||||
} while (!done || count > 0);
|
||||
|
||||
/* Destroy the temporary SPDK thread */
|
||||
spdk_fio_cleanup(td);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -390,9 +387,8 @@ spdk_fio_init(struct thread_data *td)
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_fio_cleanup(struct thread_data *td)
|
||||
spdk_fio_cleanup_thread(struct spdk_fio_thread *fio_thread)
|
||||
{
|
||||
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
||||
struct spdk_fio_target *target, *tmp;
|
||||
|
||||
TAILQ_FOREACH_SAFE(target, &fio_thread->targets, link, tmp) {
|
||||
@ -410,7 +406,14 @@ spdk_fio_cleanup(struct thread_data *td)
|
||||
spdk_ring_free(fio_thread->ring);
|
||||
free(fio_thread->iocq);
|
||||
free(fio_thread);
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_fio_cleanup(struct thread_data *td)
|
||||
{
|
||||
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
||||
|
||||
spdk_fio_cleanup_thread(fio_thread);
|
||||
td->io_ops_data = NULL;
|
||||
}
|
||||
|
||||
@ -672,25 +675,12 @@ static void
|
||||
spdk_fio_finish_env(void)
|
||||
{
|
||||
struct spdk_fio_thread *fio_thread;
|
||||
struct thread_data *td;
|
||||
int rc;
|
||||
bool done = false;
|
||||
size_t count;
|
||||
|
||||
td = calloc(1, sizeof(*td));
|
||||
if (!td) {
|
||||
SPDK_ERRLOG("Unable to allocate thread_data\n");
|
||||
return;
|
||||
}
|
||||
/* Create an SPDK thread temporarily */
|
||||
rc = spdk_fio_init_thread(td);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("Failed to create finish thread\n");
|
||||
free(td);
|
||||
return;
|
||||
}
|
||||
/* the same thread that called spdk_fio_init_env */
|
||||
fio_thread = g_thread;
|
||||
|
||||
fio_thread = td->io_ops_data;
|
||||
spdk_bdev_finish(spdk_fio_module_finish_done, &done);
|
||||
|
||||
do {
|
||||
@ -704,9 +694,7 @@ spdk_fio_finish_env(void)
|
||||
count = spdk_fio_poll_thread(fio_thread);
|
||||
} while (!done || count > 0);
|
||||
|
||||
/* Destroy the temporary SPDK thread */
|
||||
spdk_fio_cleanup(td);
|
||||
free(td);
|
||||
spdk_fio_cleanup_thread(fio_thread);
|
||||
}
|
||||
|
||||
static void fio_exit spdk_fio_unregister(void)
|
||||
|
Loading…
Reference in New Issue
Block a user