Warn more gently if the kernel is too old for io scheduler switching
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 125cf6fb6cfa93b44aaa468b0f5f6fd7fcfbbb85..160d533583b6850c30bacbd98e1ef345db5c7680 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -35,7 +35,6 @@
 #include <sys/mman.h>
 
 #include "fio.h"
-#include "os.h"
 
 unsigned long page_mask;
 unsigned long page_size;
@@ -663,7 +662,11 @@ static int switch_ioscheduler(struct thread_data *td)
 
        f = fopen(tmp, "r+");
        if (!f) {
-               td_verror(td, errno, "fopen");
+               if (errno == ENOENT) {
+                       log_err("fio: os or kernel doesn't support IO scheduler switching\n");
+                       return 0;
+               }
+               td_verror(td, errno, "fopen iosched");
                return 1;
        }
 
@@ -991,6 +994,7 @@ static void reap_threads(int *nr_running, int *t_rate, int *m_rate)
                /*
                 * thread is not dead, continue
                 */
+               pending++;
                continue;
 reaped:
                if (td->o.use_thread) {
@@ -1003,6 +1007,7 @@ reaped:
                (*nr_running)--;
                (*m_rate) -= td->o.ratemin;
                (*t_rate) -= td->o.rate;
+               pending--;
 
                if (td->error)
                        exit_value++;
@@ -1210,10 +1215,8 @@ int main(int argc, char *argv[])
        if (parse_options(argc, argv))
                return 1;
 
-       if (!thread_number) {
-               log_err("Nothing to do\n");
-               return 1;
-       }
+       if (!thread_number)
+               return 0;
 
        ps = sysconf(_SC_PAGESIZE);
        if (ps < 0) {