[PATCH 2/4] Make switch_ioscheduler() return 0 if FIO_HAVE_IOSCHED_SWITCH is undefined

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 backend.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/backend.c b/backend.c
index ad2d7da..2f290d2 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)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux