From: Tomohiro Kusumi Date: Mon, 8 Aug 2016 17:27:31 +0000 (+0900) Subject: Check if sysfs ioscheduler entry is "none" X-Git-Tag: fio-2.14~44 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=67f28a8cf74bf64c1c35fde49a425d62bb143fa8 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 --- 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)) {