Track io_u state (free or in-flight)

That way we can catch proper use by fio, so we don't get stuck
in cleanup_pending_aio() if someone forgot to put_io_u() in an
error path.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/ioengines.c b/ioengines.c
index ab5b224..1704418 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -14,6 +14,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <dlfcn.h>
+#include <assert.h>
 
 #include "fio.h"
 #include "os.h"
@@ -188,6 +189,9 @@
 {
 	int ret;
 
+	assert((io_u->flags & IO_U_F_FLIGHT) == 0);
+	io_u->flags |= IO_U_F_FLIGHT;
+
 	if (td->io_ops->flags & FIO_SYNCIO)
 		fio_gettime(&io_u->issue_time, NULL);