Make switch_ioscheduler() return 0 if FIO_HAVE_IOSCHED_SWITCH is undefined
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Fri, 29 Jul 2016 15:05:58 +0000 (00:05 +0900)
committerJens Axboe <axboe@fb.com>
Fri, 29 Jul 2016 15:01:20 +0000 (09:01 -0600)
Defining FIO_HAVE_IOSCHED_SWITCH currently equals saying it's Linux,
as switch_ioscheduler() only works on Linux kernel with "scheduler"
sysfs entry (though read/write to sysfs obviously compiles on others).

This commit makes the function return 0 if FIO_HAVE_IOSCHED_SWITCH
is undefined (i.e. if not Linux). This is essentially the same as
{diskutil,cgroup,blktrace}.c being compiled only on Linux.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
backend.c

index ad2d7daa0ed254e4256cd3ae3533922dc392e905..2f290d2d7d1358429c1a66440f79de648bfd88c9 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -1261,6 +1261,7 @@ static int init_io_u(struct thread_data *td)
 
 static int switch_ioscheduler(struct thread_data *td)
 {
+#ifdef FIO_HAVE_IOSCHED_SWITCH
        char tmp[256], tmp2[128];
        FILE *f;
        int ret;
@@ -1319,6 +1320,9 @@ static int switch_ioscheduler(struct thread_data *td)
 
        fclose(f);
        return 0;
+#else
+       return 0;
+#endif
 }
 
 static bool keep_running(struct thread_data *td)