[PATCH] Fix segfault if ioengine isn't set

Don't do it in the ioengine_cb callback, it needs to be done
unconditionally.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/init.c b/init.c
index 3eaf9b7..58aca3c 100644
--- a/init.c
+++ b/init.c
@@ -124,6 +124,17 @@
 	if (td == &def_thread)
 		return 0;
 
+	/*
+	 * Set default io engine, if none set
+	 */
+	if (!td->io_ops) {
+		td->io_ops = load_ioengine(td, DEF_IO_ENGINE_NAME);
+		if (!td->io_ops) {
+			log_err("default engine %s not there?\n", DEF_IO_ENGINE_NAME);
+			return 1;
+		}
+	}
+
 	if (td->io_ops->flags & FIO_SYNCIO)
 		td->iodepth = 1;
 	else {
@@ -594,9 +605,6 @@
 
 static int str_ioengine_cb(struct thread_data *td, char *str)
 {
-	if (!str)
-		str = DEF_IO_ENGINE_NAME;
-
 	td->io_ops = load_ioengine(td, str);
 	if (td->io_ops)
 		return 0;