Alter the order of checking time exceeded vs getting an io_u
authorRadha Ramachandran <radha@google.com>
Tue, 16 Jun 2009 06:31:29 +0000 (08:31 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 16 Jun 2009 06:31:29 +0000 (08:31 +0200)
I was hitting a case where fio would loop for ever even though the
runtime was exceeded if it had difficulty getting the io_u struct, so
I suggest this change to the code so it wld not loop forever.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c

diff --git a/fio.c b/fio.c
index bb2606286650141fbc6de0b2725855a3b09e995f..4927f1c6142fe078de0176f708ad57a34a8feec3 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -442,18 +442,17 @@ static void do_verify(struct thread_data *td)
        while (!td->terminate) {
                int ret2, full;
 
-               io_u = __get_io_u(td);
-               if (!io_u)
-                       break;
-
                update_tv_cache(td);
 
                if (runtime_exceeded(td, &td->tv_cache)) {
-                       put_io_u(td, io_u);
                        td->terminate = 1;
                        break;
                }
 
+               io_u = __get_io_u(td);
+               if (!io_u)
+                       break;
+
                if (get_next_verify(td, io_u)) {
                        put_io_u(td, io_u);
                        break;
@@ -580,18 +579,17 @@ static void do_io(struct thread_data *td)
                if (td->terminate)
                        break;
 
-               io_u = get_io_u(td);
-               if (!io_u)
-                       break;
-
                update_tv_cache(td);
 
                if (runtime_exceeded(td, &td->tv_cache)) {
-                       put_io_u(td, io_u);
                        td->terminate = 1;
                        break;
                }
 
+               io_u = get_io_u(td);
+               if (!io_u)
+                       break;
+
                /*
                 * Add verification end_io handler, if asked to verify
                 * a previously written file.