fio: don't retry engine search on failure
authorYigal Korman <ykorman@gmail.com>
Fri, 3 Jul 2020 12:38:40 +0000 (15:38 +0300)
committerJens Axboe <axboe@kernel.dk>
Fri, 3 Jul 2020 14:28:25 +0000 (08:28 -0600)
ioengine_load will try to load a given engine and if it doesn't match
the current one (default is always psync), it will remove the current
one and try again.
This makes sense when the engine is loaded successfully, but if it's
not, we try to load it twice for no reason.

Fix by failing if we were unable to load requested engine and not
retrying.

Signed-off-by: Yigal Korman <ykorman@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
init.c

diff --git a/init.c b/init.c
index e53be35a7bed07ab0ff4ed06e2e7d564585793f8..3710e3d404acf84599076098cbe6569282b448a8 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1099,6 +1099,9 @@ int ioengine_load(struct thread_data *td)
                 */
                dlhandle = td->io_ops_dlhandle;
                ops = load_ioengine(td);
+               if (!ops)
+                       goto fail;
+
                if (ops == td->io_ops && dlhandle == td->io_ops_dlhandle) {
                        if (dlhandle)
                                dlclose(dlhandle);
@@ -1113,10 +1116,8 @@ int ioengine_load(struct thread_data *td)
        }
 
        td->io_ops = load_ioengine(td);
-       if (!td->io_ops) {
-               log_err("fio: failed to load engine\n");
-               return 1;
-       }
+       if (!td->io_ops)
+               goto fail;
 
        if (td->io_ops->option_struct_size && td->io_ops->options) {
                /*
@@ -1155,6 +1156,11 @@ int ioengine_load(struct thread_data *td)
 
        td_set_ioengine_flags(td);
        return 0;
+
+fail:
+       log_err("fio: failed to load engine\n");
+       return 1;
+
 }
 
 static void init_flags(struct thread_data *td)