Revamp file open/close handling
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 48d65e0db6aa1d565c7719cb7a6a177352dcbd4c..43cc6af14e8ab632f731ae4106fce2b4e27ce5e7 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -734,16 +734,13 @@ static void *thread_main(void *data)
 
        if (!td->create_serialize && setup_files(td))
                goto err;
 
        if (!td->create_serialize && setup_files(td))
                goto err;
-       if (open_files(td))
-               goto err;
 
 
-       /*
-        * Do this late, as some IO engines would like to have the
-        * files setup prior to initializing structures.
-        */
        if (td_io_init(td))
                goto err;
 
        if (td_io_init(td))
                goto err;
 
+       if (open_files(td))
+               goto err;
+
        if (td->exec_prerun) {
                if (system(td->exec_prerun) < 0)
                        goto err;
        if (td->exec_prerun) {
                if (system(td->exec_prerun) < 0)
                        goto err;