Only flag sync_file_range() support for newer Linux versions
[fio.git] / os / os-linux.h
index ac42264b1a7b6db77b9ef78d7d104382c522b656..df0ec2dbdb51a692cc52f93097a0238844aad1ef 100644 (file)
@@ -4,9 +4,11 @@
 #include <sys/ioctl.h>
 #include <sys/uio.h>
 #include <sys/syscall.h>
+#include <sys/vfs.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <sched.h>
 #include <linux/unistd.h>
 #include <linux/raw.h>
 #include <linux/major.h>
 #define FIO_HAVE_PSHARED_MUTEX
 #define FIO_HAVE_CL_SIZE
 #define FIO_HAVE_CGROUPS
+#define FIO_HAVE_FDATASYNC
+#define FIO_HAVE_FS_STAT
+
+#ifdef SYNC_FILE_RANGE_WAIT_BEFORE
+#define FIO_HAVE_SYNC_FILE_RANGE
+#endif
 
 #define OS_MAP_ANON            MAP_ANONYMOUS
 
@@ -277,4 +285,17 @@ static inline int arch_cache_line_size(void)
                return atoi(size);
 }
 
+static inline unsigned long long get_fs_size(const char *path)
+{
+       unsigned long long ret;
+       struct statfs s;
+
+       if (statfs(path, &s) < 0)
+               return -1ULL;
+
+       ret = s.f_bsize;
+       ret *= (unsigned long long) s.f_bfree;
+       return ret;
+}
+
 #endif