From df64119de537aba99c85d1dc80190b354589f8b9 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 12 Oct 2006 07:55:41 +0200 Subject: [PATCH] [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 --- init.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/init.c b/init.c index 3eaf9b7f..58aca3c2 100644 --- a/init.c +++ b/init.c @@ -124,6 +124,17 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num) 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_mem_cb(struct thread_data *td, char *mem) 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; -- 2.25.1