Fix typo in mark_random_map()
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 2ee7dcaf81a8c49f800fee31cd58677506896fc4..fcd15286a95b971692b5ca65af9de34e2bfd5662 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -60,8 +60,8 @@ struct io_log *agg_io_log[2];
 
 static inline void td_set_runstate(struct thread_data *td, int runstate)
 {
-       dprint(FD_PROCESS, "%d: runstate %d -> %d\n", td->pid, td->runstate,
-                                                       runstate);
+       dprint(FD_PROCESS, "pid=%d: runstate %d -> %d\n", td->pid, td->runstate,
+                                                               runstate);
        td->runstate = runstate;
 }
 
@@ -571,12 +571,6 @@ sync_done:
                }
        }
 
-       /*
-        * stop job if we failed doing any IO
-        */
-       if ((td->this_io_bytes[0] + td->this_io_bytes[1]) == 0)
-               td->done = 1;
-
        if (td->o.fill_device && td->error == ENOSPC) {
                td->error = 0;
                td->terminate = 1;
@@ -599,6 +593,12 @@ sync_done:
                }
        } else
                cleanup_pending_aio(td);
+
+       /*
+        * stop job if we failed doing any IO
+        */
+       if ((td->this_io_bytes[0] + td->this_io_bytes[1]) == 0)
+               td->done = 1;
 }
 
 static void cleanup_io_u(struct thread_data *td)
@@ -639,11 +639,7 @@ static int init_io_u(struct thread_data *td)
        int i, max_units;
        char *p;
 
-       if (td->io_ops->flags & FIO_SYNCIO)
-               max_units = 1;
-       else
-               max_units = td->o.iodepth;
-
+       max_units = td->o.iodepth;
        max_bs = max(td->o.max_bs[DDIR_READ], td->o.max_bs[DDIR_WRITE]);
        td->orig_buffer_size = (unsigned long long) max_bs * (unsigned long long) max_units;
 
@@ -777,7 +773,10 @@ static int clear_io_state(struct thread_data *td)
 
        td->last_was_sync = 0;
 
-       if (td->o.time_based)
+       /*
+        * reset file done count if we are to start over
+        */
+       if (td->o.time_based || td->o.loops)
                td->nr_done_files = 0;
 
        for_each_file(td, f, i)