From 67f28a8cf74bf64c1c35fde49a425d62bb143fa8 Mon Sep 17 00:00:00 2001 From: Tomohiro Kusumi Date: Tue, 9 Aug 2016 02:27:31 +0900 Subject: [PATCH] Check if sysfs ioscheduler entry is "none" Block devices without elevator (bio-based-dm/loop/etc) have "none" for sysfs ioscheduler tunable, and write to this entry never fail from the way elv_iosched_store() is implemented. This commit checks if the entry is "none" type so as not to show an irrelevant error message which assumes the entry has a list of available I/O schedulers. # cat /sys/block/dm-0/queue/scheduler none # echo deadline > /sys/block/dm-0/queue/scheduler ; echo $? 0 # cat /sys/block/dm-0/queue/scheduler none # echo aaa > /sys/block/dm-0/queue/scheduler ; echo $? 0 # cat /sys/block/dm-0/queue/scheduler none Signed-off-by: Tomohiro Kusumi Signed-off-by: Jens Axboe --- backend.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend.c b/backend.c index 58727114..6bf5d679 100644 --- a/backend.c +++ b/backend.c @@ -1331,6 +1331,14 @@ static int switch_ioscheduler(struct thread_data *td) */ tmp[strlen(tmp) - 1] = '\0'; + /* + * Write to "none" entry doesn't fail, so check the result here. + */ + if (!strcmp(tmp, "none")) { + log_err("fio: io scheduler is not tunable\n"); + fclose(f); + return 0; + } sprintf(tmp2, "[%s]", td->o.ioscheduler); if (!strstr(tmp, tmp2)) { -- 2.25.1