Move ->commit() call to td_io_getevents()

If we need to complete some events (min > 0), make sure we
have committed a pending batch.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/ioengines.c b/ioengines.c
index 0b3ec16..727981f 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -182,6 +182,12 @@
 int td_io_getevents(struct thread_data *td, int min, int max,
 		    struct timespec *t)
 {
+	if (min > 0 && td->io_ops->commit) {
+		int r = td->io_ops->commit(td);
+
+		if (r < 0)
+			return r;
+	}
 	if (td->io_ops->getevents)
 		return td->io_ops->getevents(td, min, max, t);