From 7401c088106ba35dcfba62ec753b6b20b72ad0e2 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 9 Mar 2007 13:45:11 +0100 Subject: [PATCH] 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 --- engines/null.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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; } -- 2.25.1