fio_plugin: add spdk_fio_poll_thread

Separated SPDK-related code
from the FIO callback spdk_fio_getevents.
This is required for upcoming patches.

Change-Id: I8d30a3f910f29b13344df91fbbff51e00dfa0a0a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/386102
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-11-07 20:23:21 +01:00 committed by Daniel Verkamp
parent aaa189ae7f
commit 4314d72505

View File

@ -534,25 +534,13 @@ spdk_fio_event(struct thread_data *td, int event)
return fio_thread->iocq[event];
}
static int
spdk_fio_getevents(struct thread_data *td, unsigned int min,
unsigned int max, const struct timespec *t)
static size_t
spdk_fio_poll_thread(struct spdk_fio_thread *fio_thread)
{
struct spdk_fio_thread *fio_thread = td->io_ops_data;
struct timespec t0, t1;
uint64_t timeout = 0;
struct spdk_fio_msg *msg;
struct spdk_fio_poller *p, *tmp;
size_t count;
if (t) {
timeout = t->tv_sec * 1000000000L + t->tv_nsec;
clock_gettime(CLOCK_MONOTONIC_RAW, &t0);
}
fio_thread->iocq_count = 0;
for (;;) {
/* Process new events */
count = spdk_ring_dequeue(fio_thread->ring, (void **)&msg, 1);
if (count > 0) {
@ -565,6 +553,27 @@ spdk_fio_getevents(struct thread_data *td, unsigned int min,
p->cb_fn(p->cb_arg);
}
return count;
}
static int
spdk_fio_getevents(struct thread_data *td, unsigned int min,
unsigned int max, const struct timespec *t)
{
struct spdk_fio_thread *fio_thread = td->io_ops_data;
struct timespec t0, t1;
uint64_t timeout = 0;
if (t) {
timeout = t->tv_sec * 1000000000L + t->tv_nsec;
clock_gettime(CLOCK_MONOTONIC_RAW, &t0);
}
fio_thread->iocq_count = 0;
for (;;) {
spdk_fio_poll_thread(fio_thread);
if (fio_thread->iocq_count >= min) {
return fio_thread->iocq_count;
}