splice engine: support for vmsplice to user space
[fio.git] / os / os-linux.h
index 90349016ffe1004ae84904ec45922125f8e96b4a..836a52f390c65a9cd8efb9be7709c9a424dfd23c 100644 (file)
@@ -22,6 +22,7 @@
 #define FIO_HAVE_ODIRECT
 #define FIO_HAVE_HUGETLB
 #define FIO_HAVE_RAWBIND
 #define FIO_HAVE_ODIRECT
 #define FIO_HAVE_HUGETLB
 #define FIO_HAVE_RAWBIND
+#define FIO_HAVE_BLKTRACE
 
 #define OS_MAP_ANON            (MAP_ANONYMOUS)
 
 
 #define OS_MAP_ANON            (MAP_ANONYMOUS)
 
@@ -34,10 +35,21 @@ typedef struct drand48_data os_random_state_t;
 #define fadvise(fd, off, len, advice)  \
        posix_fadvise((fd), (off_t)(off), (len), (advice))
 
 #define fadvise(fd, off, len, advice)  \
        posix_fadvise((fd), (off_t)(off), (len), (advice))
 
+/*
+ * If you are on an ancient glibc (2.3.2), then define GLIBC_2_3_2 if you want
+ * the affinity helpers to work.
+ */
+#ifndef GLIBC_2_3_2
 #define fio_setaffinity(td)            \
        sched_setaffinity((td)->pid, sizeof((td)->o.cpumask), &(td)->o.cpumask)
 #define fio_getaffinity(pid, ptr)      \
        sched_getaffinity((pid), sizeof(cpu_set_t), (ptr))
 #define fio_setaffinity(td)            \
        sched_setaffinity((td)->pid, sizeof((td)->o.cpumask), &(td)->o.cpumask)
 #define fio_getaffinity(pid, ptr)      \
        sched_getaffinity((pid), sizeof(cpu_set_t), (ptr))
+#else
+#define fio_setaffinity(td)            \
+       sched_setaffinity((td)->pid, &(td)->o.cpumask)
+#define fio_getaffinity(pid, ptr)      \
+       sched_getaffinity((pid), (ptr))
+#endif
 
 static inline int ioprio_set(int which, int who, int ioprio)
 {
 
 static inline int ioprio_set(int which, int who, int ioprio)
 {
@@ -74,6 +86,10 @@ static inline int vmsplice(int fd, const struct iovec *iov,
 }
 #endif
 
 }
 #endif
 
+#ifdef SPLICE_F_UNMAP
+#define SPLICE_F_UNMAP (0x10)
+#endif
+
 #define SPLICE_DEF_SIZE        (64*1024)
 
 #ifdef FIO_HAVE_SYSLET
 #define SPLICE_DEF_SIZE        (64*1024)
 
 #ifdef FIO_HAVE_SYSLET
@@ -109,12 +125,20 @@ static inline long umem_add(unsigned long *uptr, unsigned long inc)
 }
 #endif /* FIO_HAVE_SYSLET */
 
 }
 #endif /* FIO_HAVE_SYSLET */
 
+enum {
+       IOPRIO_CLASS_NONE,
+       IOPRIO_CLASS_RT,
+       IOPRIO_CLASS_BE,
+       IOPRIO_CLASS_IDLE,
+};
+
 enum {
        IOPRIO_WHO_PROCESS = 1,
        IOPRIO_WHO_PGRP,
        IOPRIO_WHO_USER,
 };
 
 enum {
        IOPRIO_WHO_PROCESS = 1,
        IOPRIO_WHO_PGRP,
        IOPRIO_WHO_USER,
 };
 
+#define IOPRIO_BITS            16
 #define IOPRIO_CLASS_SHIFT     13
 
 #ifndef BLKGETSIZE64
 #define IOPRIO_CLASS_SHIFT     13
 
 #ifndef BLKGETSIZE64