fio: Do bdev shutdown in a thread message

This ensures that it occurs on an SPDK thread

Change-Id: I62d15d6b0fd4fe56939c664e44eecd3199014292
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/436552
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Ben Walker 2018-12-07 13:41:45 -07:00
parent c4f0818bd3
commit b9cdb813fe

View File

@ -139,12 +139,6 @@ spdk_fio_cleanup_thread(struct spdk_fio_thread *fio_thread)
free(fio_thread); free(fio_thread);
} }
static void
spdk_fio_module_finish_done(void *cb_arg)
{
*(bool *)cb_arg = true;
}
static void static void
spdk_fio_calc_timeout(struct timespec *ts, uint64_t us) spdk_fio_calc_timeout(struct timespec *ts, uint64_t us)
{ {
@ -178,6 +172,28 @@ spdk_fio_bdev_init_start(void *arg)
spdk_bdev_initialize(spdk_fio_bdev_init_done, done); spdk_bdev_initialize(spdk_fio_bdev_init_done, done);
} }
static void
spdk_fio_bdev_fini_done(void *cb_arg)
{
*(bool *)cb_arg = true;
}
static void
spdk_fio_copy_fini_start(void *arg)
{
bool *done = arg;
spdk_copy_engine_finish(spdk_fio_bdev_fini_done, done);
}
static void
spdk_fio_bdev_fini_start(void *arg)
{
bool *done = arg;
spdk_bdev_finish(spdk_fio_copy_fini_start, done);
}
static void * static void *
spdk_init_thread_poll(void *arg) spdk_init_thread_poll(void *arg)
{ {
@ -187,7 +203,6 @@ spdk_init_thread_poll(void *arg)
struct spdk_env_opts opts; struct spdk_env_opts opts;
bool done; bool done;
int rc; int rc;
size_t count;
struct timespec ts; struct timespec ts;
struct thread_data td = {}; struct thread_data td = {};
@ -284,27 +299,15 @@ spdk_init_thread_poll(void *arg)
pthread_mutex_unlock(&g_init_mtx); pthread_mutex_unlock(&g_init_mtx);
/* Finalize the bdev layer */
done = false; done = false;
spdk_bdev_finish(spdk_fio_module_finish_done, &done); spdk_thread_send_msg(fio_thread->thread, spdk_fio_bdev_fini_start, &done);
do { do {
spdk_fio_poll_thread(fio_thread); spdk_fio_poll_thread(fio_thread);
} while (!done); } while (!done);
do { while (spdk_fio_poll_thread(fio_thread) > 0) {};
count = spdk_fio_poll_thread(fio_thread);
} while (count > 0);
done = false;
spdk_copy_engine_finish(spdk_fio_module_finish_done, &done);
do {
spdk_fio_poll_thread(fio_thread);
} while (!done);
do {
count = spdk_fio_poll_thread(fio_thread);
} while (count > 0);
spdk_fio_cleanup_thread(fio_thread); spdk_fio_cleanup_thread(fio_thread);