From ac684785b41aaf17593b375be8d3e89b83974c1a Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 8 Nov 2007 08:29:07 +0100 Subject: [PATCH] Seperate ioprio value from setting Newer kernels allow passing a value of '0' for resetting ioprio, and our check for if (td->ioprio) doesn't allow passing a value of 0 into sys_ioprio_set(). So seperate the setting from the value by adding a ->ioprio_set bool. Signed-off-by: Jens Axboe --- fio.c | 2 +- fio.h | 1 + options.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fio.c b/fio.c index 6f9a378b..e71537fc 100644 --- a/fio.c +++ b/fio.c @@ -829,7 +829,7 @@ static void *thread_main(void *data) goto err; } - if (td->ioprio) { + if (td->ioprio_set) { if (ioprio_set(IOPRIO_WHO_PROCESS, 0, td->ioprio) == -1) { td_verror(td, errno, "ioprio_set"); goto err; diff --git a/fio.h b/fio.h index 208f7428..5ca2ad36 100644 --- a/fio.h +++ b/fio.h @@ -522,6 +522,7 @@ struct thread_data { volatile int terminate; volatile int runstate; unsigned int ioprio; + unsigned int ioprio_set; unsigned int last_was_sync; char *mmapfile; diff --git a/options.c b/options.c index e1516344..0fc99557 100644 --- a/options.c +++ b/options.c @@ -74,6 +74,7 @@ static int str_prioclass_cb(void *data, unsigned int *val) td->ioprio &= mask; td->ioprio |= *val << IOPRIO_CLASS_SHIFT; + td->ioprio_set = 1; return 0; } @@ -89,6 +90,7 @@ static int str_prio_cb(void *data, unsigned int *val) if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0) td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT; + td->ioprio_set = 1; return 0; } #endif -- 2.25.1