From: Jens Axboe Date: Fri, 9 Mar 2007 12:45:11 +0000 (+0100) Subject: null engine: fix queue bug with repeated commit() calls before event retrieval X-Git-Tag: fio-1.14~49 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=7401c088106ba35dcfba62ec753b6b20b72ad0e2;hp=65afa5f2146ee010b7129934f68e691faee54982 null engine: fix queue bug with repeated commit() calls before event retrieval Don't return anything if min_events == 0. This exposed a bug in the commit handler, it needs to add to ->events, not set it. Signed-off-by: Jens Axboe --- diff --git a/engines/null.c b/engines/null.c index 19886789..67ac4535 100644 --- a/engines/null.c +++ b/engines/null.c @@ -24,14 +24,17 @@ static struct io_u *fio_null_event(struct thread_data *td, int event) return nd->io_us[event]; } -static int fio_null_getevents(struct thread_data *td, int fio_unused min, +static int fio_null_getevents(struct thread_data *td, int min_events, int fio_unused max, struct timespec fio_unused *t) { struct null_data *nd = td->io_ops->data; - int ret; + int ret = 0; + + if (min_events) { + ret = nd->events; + nd->events = 0; + } - ret = nd->events; - nd->events = 0; return ret; } @@ -39,7 +42,7 @@ static int fio_null_commit(struct thread_data *td) { struct null_data *nd = td->io_ops->data; - nd->events = nd->queued; + nd->events += nd->queued; nd->queued = 0; return 0; }