[PATCH] Fix sg ioengine

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>
diff --git a/fio.c b/fio.c
index 4c761c0..7ddde7d 100644
--- a/fio.c
+++ b/fio.c
@@ -647,9 +647,6 @@
 		goto err;
 	}
 
-	if (td_io_init(td))
-		goto err;
-
 	if (init_iolog(td))
 		goto err;
 
@@ -680,6 +677,13 @@
 	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);