Seperate ioprio value from setting
authorJens Axboe <jens.axboe@oracle.com>
Thu, 8 Nov 2007 07:29:07 +0000 (08:29 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 8 Nov 2007 07:29:07 +0000 (08:29 +0100)
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 <jens.axboe@oracle.com>
fio.c
fio.h
options.c

diff --git a/fio.c b/fio.c
index 6f9a378b3599084927f1cb940aa9b28d8ff7648d..e71537fc9d45c379d53c001d1ae160e42b6eb435 100644 (file)
--- 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 208f742889753c572880b89948fe9f63c572a202..5ca2ad366766e6f715c88c13ac7ad5b167e0d16e 100644 (file)
--- 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;
index e151634415bb5c2e64c8c318da18c560ce3692b8..0fc9955729f55ce54ce4a66d7284f5db74778097 100644 (file)
--- 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