X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=io_u.c;h=d30ff4b3467dc352feec1de944c71c15716c017e;hp=23a64b046861bcf13e68bf316fd5111593468ca4;hb=0c6e75175bcaf8d05bfa88aa8caa584fbb848b74;hpb=145dad6d3e1ae4bf44dd49eea9d0c025500b97d0 diff --git a/io_u.c b/io_u.c index 23a64b04..d30ff4b3 100644 --- a/io_u.c +++ b/io_u.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "fio.h" #include "os.h" @@ -193,6 +194,9 @@ static enum fio_ddir get_rw_ddir(struct thread_data *td) void put_io_u(struct thread_data *td, struct io_u *io_u) { + assert((io_u->flags & IO_U_F_FREE) == 0); + io_u->flags |= IO_U_F_FREE; + io_u->file = NULL; list_del(&io_u->list); list_add(&io_u->list, &td->io_u_freelist); @@ -352,6 +356,9 @@ struct io_u *__get_io_u(struct thread_data *td) } if (io_u) { + assert(io_u->flags & IO_U_F_FREE); + io_u->flags &= ~IO_U_F_FREE; + io_u->error = 0; list_del(&io_u->list); list_add(&io_u->list, &td->io_u_busylist); @@ -441,6 +448,9 @@ static void io_completed(struct thread_data *td, struct io_u *io_u, { unsigned long msec; + assert(io_u->flags & IO_U_F_FLIGHT); + io_u->flags &= ~IO_U_F_FLIGHT; + if (io_u->ddir == DDIR_SYNC) { td->last_was_sync = 1; return;