Fixup bad logging types
[fio.git] / os / os-linux.h
index 4e837da93720c34e5960b0c1e298a703b0fb08de..869a25d8ee5d86c684762d91c4f7a4496f2b5d7f 100644 (file)
@@ -75,18 +75,6 @@ static inline int fio_cpuset_exit(os_cpu_mask_t *mask)
 
 #define FIO_MAX_CPUS                   CPU_SETSIZE
 
-static inline int ioprio_set(int which, int who, int ioprio)
-{
-       return syscall(__NR_ioprio_set, which, who, ioprio);
-}
-
-static inline int gettid(void)
-{
-       return syscall(__NR_gettid);
-}
-
-#define SPLICE_DEF_SIZE        (64*1024)
-
 enum {
        IOPRIO_CLASS_NONE,
        IOPRIO_CLASS_RT,
@@ -103,6 +91,25 @@ enum {
 #define IOPRIO_BITS            16
 #define IOPRIO_CLASS_SHIFT     13
 
+static inline int ioprio_set(int which, int who, int ioprio_class, int ioprio)
+{
+       /*
+        * If no class is set, assume BE
+        */
+       if (!ioprio_class)
+               ioprio_class = IOPRIO_CLASS_BE;
+
+       ioprio |= ioprio_class << IOPRIO_CLASS_SHIFT;
+       return syscall(__NR_ioprio_set, which, who, ioprio);
+}
+
+static inline int gettid(void)
+{
+       return syscall(__NR_gettid);
+}
+
+#define SPLICE_DEF_SIZE        (64*1024)
+
 #ifndef BLKGETSIZE64
 #define BLKGETSIZE64   _IOR(0x12,114,size_t)
 #endif
@@ -246,4 +253,12 @@ static inline int os_trim(int fd, unsigned long long start,
        return errno;
 }
 
+#ifdef CONFIG_SCHED_IDLE
+static inline int fio_set_sched_idle(void)
+{
+       struct sched_param p = { .sched_priority = 0, };
+       return sched_setscheduler(gettid(), SCHED_IDLE, &p);
+}
+#endif
+
 #endif