Test fsync/fdatasync/sync_file_range for the next i/o only if should_fsync(td)
[fio.git] / os / os-android.h
index 954178ddaecf3c25805db4e55a22ab104f570b69..b59fac159ef47796e2860fccf464845116e074d1 100644 (file)
@@ -4,6 +4,7 @@
 #define        FIO_OS  os_android
 
 #include <sys/ioctl.h>
+#include <sys/mman.h>
 #include <sys/uio.h>
 #include <sys/syscall.h>
 #include <sys/vfs.h>
 #include <linux/major.h>
 #include <asm/byteorder.h>
 
+#include "./os-linux-syscall.h"
 #include "binject.h"
 #include "../file.h"
 
 #define FIO_HAVE_DISK_UTIL
 #define FIO_HAVE_IOSCHED_SWITCH
 #define FIO_HAVE_IOPRIO
+#define FIO_HAVE_IOPRIO_CLASS
 #define FIO_HAVE_ODIRECT
 #define FIO_HAVE_HUGETLB
 #define FIO_HAVE_BLKTRACE
-#define FIO_HAVE_PSHARED_MUTEX
 #define FIO_HAVE_CL_SIZE
 #define FIO_HAVE_FS_STAT
 #define FIO_HAVE_TRIM
 
 #define OS_MAP_ANON            MAP_ANONYMOUS
 
+#ifndef POSIX_MADV_DONTNEED
 #define posix_madvise   madvise
 #define POSIX_MADV_DONTNEED MADV_DONTNEED
 #define POSIX_MADV_SEQUENTIAL  MADV_SEQUENTIAL
 #define POSIX_MADV_RANDOM      MADV_RANDOM
+#endif
+
 #ifdef MADV_REMOVE
 #define FIO_MADV_FREE  MADV_REMOVE
 #endif
@@ -136,6 +141,12 @@ enum {
 #define IOPRIO_BITS            16
 #define IOPRIO_CLASS_SHIFT     13
 
+#define IOPRIO_MIN_PRIO                0       /* highest priority */
+#define IOPRIO_MAX_PRIO                7       /* lowest priority */
+
+#define IOPRIO_MIN_PRIO_CLASS  0
+#define IOPRIO_MAX_PRIO_CLASS  3
+
 static inline int ioprio_set(int which, int who, int ioprio_class, int ioprio)
 {
        /*
@@ -234,7 +245,7 @@ static inline int arch_cache_line_size(void)
                return atoi(size);
 }
 
-static inline unsigned long long get_fs_size(const char *path)
+static inline unsigned long long get_fs_free_size(const char *path)
 {
        unsigned long long ret;
        struct statfs s;
@@ -261,4 +272,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