[PATCH] Fix sg ioengine
authorJens Axboe <jens.axboe@oracle.com>
Mon, 5 Feb 2007 09:52:10 +0000 (10:52 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 5 Feb 2007 09:52:10 +0000 (10:52 +0100)
We need to do the ->init() call after having opened the file,
otherwise sg doesn't know what file type it is dealing with.

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

diff --git a/fio.c b/fio.c
index 4c761c038bd170f16d0d10c094c69e96f7fa503f..7ddde7d18561393c692e44a6cc6f6b09e942b3e5 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -647,9 +647,6 @@ static void *thread_main(void *data)
                goto err;
        }
 
-       if (td_io_init(td))
-               goto err;
-
        if (init_iolog(td))
                goto err;
 
@@ -680,6 +677,13 @@ static void *thread_main(void *data)
        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->exec_prerun)
                system(td->exec_prerun);