From db815fb3d7e158665179a31819929bcfba3156de Mon Sep 17 00:00:00 2001 From: Tomohiro Kusumi Date: Sat, 30 Jul 2016 00:05:58 +0900 Subject: [PATCH] Make switch_ioscheduler() return 0 if FIO_HAVE_IOSCHED_SWITCH is undefined 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 Signed-off-by: Jens Axboe --- backend.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend.c b/backend.c index ad2d7daa..2f290d2d 100644 --- 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) -- 2.25.1