bdev/fio_plugin: flush any remaining events after done

In some cases, an io_channel will be put (freed) as part
of the last execution of a poller.  Previously, the
callback would set done=1 and would not continue
executing events meaning the deferred put_io_channel
events would not get executed.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia5a6ea6873ceb1c3d5daf0545cdc3615d11712d2

Reviewed-on: https://review.gerrithub.io/402139
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Jim Harris 2018-03-01 11:03:04 -07:00 committed by Daniel Verkamp
parent a562812dcf
commit 068b6fb34d

View File

@ -273,10 +273,18 @@ spdk_fio_init_env(struct thread_data *td)
/* Initialize the bdev layer */
spdk_bdev_initialize(spdk_fio_bdev_init_done, &done);
/* First, poll until initialization is done. */
do {
spdk_fio_poll_thread(fio_thread);
} while (!done);
/*
* Continue polling until there are no more events.
* This handles any final events posted by pollers.
*/
do {
/* Handle init and all cleanup events */
count = spdk_fio_poll_thread(fio_thread);
} while (!done || count > 0);
} while (count > 0);
return 0;
}
@ -677,16 +685,24 @@ spdk_fio_finish_env(void)
spdk_bdev_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 (!done || count > 0);
} 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 (!done || count > 0);
} while (count > 0);
spdk_fio_cleanup_thread(fio_thread);
}