numa_cpu_nodes=str Set this job running on spcified NUMA nodes' CPUs. The
arguments allow comma delimited list of cpu numbers,
A-B ranges, or 'all'. Note, to enable numa options support,
- export the following environment variables,
- export EXTFLAGS+=" -DFIO_HAVE_LIBNUMA "
- export EXTLIBS+=" -lnuma "
+ fio must be built on a system with libnuma-dev(el) installed.
numa_mem_policy=str Set this job's memory policy and corresponding NUMA
nodes. Format of the argements:
-CC ?= gcc
DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
CPPFLAGS= -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
$(DEBUGFLAGS)
SCRIPTS = fio_generate_plots
UNAME := $(shell uname)
+ifneq ($(wildcard config-host.mak),)
+all:
+include config-host.mak
+config-host-mak: configure
+ @echo $@ is out-of-date, running configure
+ @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
+else
+config-host.mak:
+ @echo "Running configure for you..."
+ @./configure
+all:
+include config-host.mak
+endif
+
SOURCE := gettime.c fio.c ioengines.c init.c stat.c log.c time.c filesetup.c \
eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \
rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \
lib/num2str.c lib/ieee754.c $(wildcard crc/*.c) engines/cpu.c \
engines/mmap.c engines/sync.c engines/null.c engines/net.c \
memalign.c server.c client.c iolog.c backend.c libfio.c flow.c \
- json.c lib/zipf.c lib/axmap.c lib/lfsr.c gettime-thread.c
+ json.c lib/zipf.c lib/axmap.c lib/lfsr.c gettime-thread.c \
+ helpers.c
+
+ifdef CONFIG_64BIT
+ CFLAGS += -DBITS_PER_LONG=64
+endif
+ifdef CONFIG_32BIT
+ CFLAGS += -DBITS_PER_LONG=32
+endif
+
+ifdef CONFIG_LIBAIO
+ CFLAGS += -DCONFIG_LIBAIO
+ SOURCE += engines/libaio.c
+endif
+ifdef CONFIG_RDMA
+ CFLAGS += -DCONFIG_RDMA
+ SOURCE += engines/rdma.c
+endif
+ifdef CONFIG_POSIXAIO
+ CFLAGS += -DCONFIG_POSIXAIO
+ SOURCE += engines/posixaio.c
+endif
+ifdef CONFIG_LINUX_FALLOCATE
+ SOURCE += engines/falloc.c
+endif
+ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
+ SOURCE += engines/e4defrag.c
+endif
+ifdef CONFIG_LINUX_SPLICE
+ CFLAGS += -DCONFIG_LINUX_SPLICE
+ SOURCE += engines/splice.c
+endif
+ifdef CONFIG_GUASI
+ CFLAGS += -DCONFIG_GUASI
+ SOURCE += engines/guasi.c
+endif
+ifdef CONFIG_FUSION_AW
+ CFLAGS += -DCONFIG_FUSION_AW
+ SOURCE += engines/fusion-aw.c
+endif
+ifdef CONFIG_SOLARISAIO
+ CFLAGS += -DCONFIG_SOLARISAIO
+ SOURCE += engines/solarisaio.c
+endif
+
+ifndef CONFIG_STRSEP
+ CFLAGS += -DCONFIG_STRSEP
+ SOURCE += lib/strsep.c
+endif
+ifndef CONFIG_GETOPT_LONG_ONLY
+ CFLAGS += -DCONFIG_GETOPT_LONG_ONLY
+ SOURCE += lib/getopt_long.c
+endif
+
+ifndef CONFIG_INET_ATON
+ CFLAGS += -DCONFIG_INET_ATON
+ SOURCE += lib/inet_aton.c
+endif
+ifdef CONFIG_CLOCK_GETTIME
+ CFLAGS += -DCONFIG_CLOCK_GETTIME
+endif
+ifdef CONFIG_POSIXAIO_FSYNC
+ CFLAGS += -DCONFIG_POSIXAIO_FSYNC
+endif
+ifdef CONFIG_FADVISE
+ CFLAGS += -DCONFIG_FADVISE
+endif
+ifdef CONFIG_CLOCK_MONOTONIC
+ CFLAGS += -DCONFIG_CLOCK_MONOTONIC
+endif
+ifdef CONFIG_CLOCK_MONOTONIC_PRECISE
+ CFLAGS += -DCONFIG_CLOCK_MONOTONIC_PRECISE
+endif
+ifdef CONFIG_GETTIMEOFDAY
+ CFLAGS += -DCONFIG_GETTIMEOFDAY
+endif
+ifdef CONFIG_SOCKLEN_T
+ CFLAGS += -DCONFIG_SOCKLEN_T
+endif
+ifdef CONFIG_SFAA
+ CFLAGS += -DCONFIG_SFAA
+endif
+ifdef CONFIG_FDATASYNC
+ CFLAGS += -DCONFIG_FDATASYNC
+endif
+ifdef CONFIG_3ARG_AFFINITY
+ CFLAGS += -DCONFIG_3ARG_AFFINITY
+endif
+ifdef CONFIG_2ARG_AFFINITY
+ CFLAGS += -DCONFIG_2ARG_AFFINITY
+endif
+ifdef CONFIG_SYNC_FILE_RANGE
+ CFLAGS += -DCONFIG_SYNC_FILE_RANGE
+endif
+ifdef CONFIG_LIBNUMA
+ CFLAGS += -DCONFIG_LIBNUMA
+endif
+ifdef CONFIG_TLS_THREAD
+ CFLAGS += -DCONFIG_TLS_THREAD
+endif
ifeq ($(UNAME), Linux)
- SOURCE += diskutil.c fifo.c blktrace.c helpers.c cgroup.c trim.c \
- engines/libaio.c engines/posixaio.c engines/sg.c \
- engines/splice.c engines/syslet-rw.c engines/guasi.c \
- engines/binject.c engines/rdma.c profiles/tiobench.c \
- engines/fusion-aw.c engines/falloc.c engines/e4defrag.c
- LIBS += -lpthread -ldl -lrt -laio
+ SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \
+ engines/binject.c profiles/tiobench.c
+ LIBS += -lpthread -ldl
LDFLAGS += -rdynamic
endif
ifeq ($(UNAME), Android)
- SOURCE += diskutil.c fifo.c blktrace.c helpers.c trim.c \
- engines/splice.c profiles/tiobench.c engines/falloc.c \
- engines/e4defrag.c
+ SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c
LIBS += -ldl
LDFLAGS += -rdynamic
CPPFLAGS += -DFIO_NO_HAVE_SHM_H
endif
ifeq ($(UNAME), SunOS)
- CC = gcc
- SOURCE += fifo.c lib/strsep.c helpers.c engines/posixaio.c \
- engines/solarisaio.c
LIBS += -lpthread -ldl -laio -lrt -lnsl -lsocket
CPPFLAGS += -D__EXTENSIONS__
endif
ifeq ($(UNAME), FreeBSD)
- SOURCE += helpers.c engines/posixaio.c
LIBS += -lpthread -lrt
LDFLAGS += -rdynamic
endif
ifeq ($(UNAME), NetBSD)
- SOURCE += helpers.c engines/posixaio.c
LIBS += -lpthread -lrt
LDFLAGS += -rdynamic
endif
ifeq ($(UNAME), AIX)
- SOURCE += fifo.c helpers.c lib/getopt_long.c engines/posixaio.c
LIBS += -lpthread -ldl -lrt
CPPFLAGS += -D_LARGE_FILES -D__ppc__
LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000
endif
ifeq ($(UNAME), HP-UX)
- CC = gcc
- SOURCE += fifo.c helpers.c lib/getopt_long.c lib/strsep.c engines/posixaio.c
LIBS += -lpthread -ldl -lrt
- CFLAGS += -D_LARGEFILE64_SOURCE
+ CFLAGS += -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE_EXTENDED
endif
ifeq ($(UNAME), Darwin)
- SOURCE += helpers.c engines/posixaio.c
LIBS += -lpthread -ldl
endif
ifneq (,$(findstring CYGWIN,$(UNAME)))
SOURCE += engines/windowsaio.c os/windows/posix.c
LIBS += -lpthread -lpsapi -lws2_32
CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format
- CC = x86_64-w64-mingw32-gcc
- #CC = i686-w64-mingw32-gcc
endif
OBJS = $(SOURCE:.c=.o)
$(PROGS): .depend
clean: FORCE
- -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE
+ -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE config-host.mak config-host.ld cscope.out
cscope:
@cscope -b -R
#define __NR_sys_vmsplice 316
#endif
-#ifndef __NR_async_exec
-#define __NR_async_exec 325
-#define __NR_async_wait 326
-#define __NR_umem_add 327
-#define __NR_async_thread 328
-#endif
-
#define FIO_HUGE_PAGE 4194304
-#define FIO_HAVE_SYSLET
-
#define nop __asm__ __volatile__("rep;nop": : :"memory")
#define read_barrier() __asm__ __volatile__("": : :"memory")
#define write_barrier() __asm__ __volatile__("": : :"memory")
#define __NR_sys_vmsplice 278
#endif
-#ifndef __NR_async_exec
-#define __NR_async_exec 286
-#define __NR_async_wait 287
-#define __NR_umem_add 288
-#define __NR_async_thread 289
-#endif
-
#define FIO_HUGE_PAGE 2097152
-#define FIO_HAVE_SYSLET
-
#define nop __asm__ __volatile__("rep;nop": : :"memory")
#define read_barrier() __asm__ __volatile__("lfence":::"memory")
#define write_barrier() __asm__ __volatile__("sfence":::"memory")
#ifndef ARCH_H
#define ARCH_H
-#include <stdint.h>
-
-#ifdef __WORDSIZE
-#define BITS_PER_LONG __WORDSIZE
-#else
-#define BITS_PER_LONG 32
-#endif
-
enum {
arch_x86_64 = 1,
arch_i386,
goto err;
}
-#ifdef FIO_HAVE_LIBNUMA
+#ifdef CONFIG_LIBNUMA
/* numa node setup */
if (td->o.numa_cpumask_set || td->o.numa_memmask_set) {
int ret;
static int fio_client_connect_ip(struct fio_client *client)
{
struct sockaddr *addr;
- fio_socklen_t socklen;
+ socklen_t socklen;
int fd, domain;
if (client->ipv6) {
static int fio_client_connect_sock(struct fio_client *client)
{
struct sockaddr_un *addr = &client->addr_un;
- fio_socklen_t len;
+ socklen_t len;
int fd;
memset(addr, 0, sizeof(*addr));
struct timeval tv;
int ret = 0;
- gettimeofday(&tv, NULL);
+ fio_gettime(&tv, NULL);
flist_for_each_safe(entry, tmp, &client_list) {
client = flist_entry(entry, struct fio_client, list);
struct pollfd *pfds;
int i, ret = 0, retval = 0;
- gettimeofday(&eta_tv, NULL);
+ fio_gettime(&eta_tv, NULL);
pfds = malloc(nr_clients * sizeof(struct pollfd));
do {
struct timeval tv;
- gettimeofday(&tv, NULL);
+ fio_gettime(&tv, NULL);
if (mtime_since(&eta_tv, &tv) >= 900) {
request_client_etas();
memcpy(&eta_tv, &tv, sizeof(tv));
#define __must_check
#endif
-#ifndef _weak
-#ifndef __CYGWIN__
-#define _weak __attribute__((weak))
-#else
-#define _weak
-#endif
-#endif
-
#endif
--- /dev/null
+#!/bin/sh
+#
+# Fio configure script. Heavily influenced by the manual qemu configure
+# script. Sad this this is easier than autoconf and enemies.
+#
+
+# set temporary file name
+if test ! -z "$TMPDIR" ; then
+ TMPDIR1="${TMPDIR}"
+elif test ! -z "$TEMPDIR" ; then
+ TMPDIR1="${TEMPDIR}"
+else
+ TMPDIR1="/tmp"
+fi
+
+TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c"
+TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
+TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe"
+
+# NB: do not call "exit" in the trap handler; this is buggy with some shells;
+# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
+trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
+
+rm -rf config.log
+
+config_host_mak="config-host.mak"
+config_host_ld="config-host.ld"
+
+# Print a helpful header at the top of config.log
+echo "# FIO configure log $(date)" >> config.log
+printf "# Configured with:" >> config.log
+printf " '%s'" "$0" "$@" >> config.log
+echo >> config.log
+echo "#" >> config.log
+
+do_cc() {
+ # Run the compiler, capturing its output to the log.
+ echo $cc "$@" >> config.log
+ $cc "$@" >> config.log 2>&1 || return $?
+ # Test passed. If this is an --enable-werror build, rerun
+ # the test with -Werror and bail out if it fails. This
+ # makes warning-generating-errors in configure test code
+ # obvious to developers.
+ if test "$werror" != "yes"; then
+ return 0
+ fi
+ # Don't bother rerunning the compile if we were already using -Werror
+ case "$*" in
+ *-Werror*)
+ return 0
+ ;;
+ esac
+ echo $cc -Werror "$@" >> config.log
+ $cc -Werror "$@" >> config.log 2>&1 && return $?
+ echo "ERROR: configure test passed without -Werror but failed with -Werror."
+ echo "This is probably a bug in the configure script. The failing command"
+ echo "will be at the bottom of config.log."
+ echo "You can run configure with --disable-werror to bypass this check."
+ exit 1
+}
+
+compile_object() {
+ do_cc $CFLAGS -c -o $TMPO $TMPC
+}
+
+compile_prog() {
+ local_cflags="$1"
+ local_ldflags="$2"
+ echo "Compiling test case $3" >> config.log
+ do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
+}
+
+feature_not_found() {
+ feature=$1
+
+ echo "ERROR"
+ echo "ERROR: User requested feature $feature"
+ echo "ERROR: configure was not able to find it"
+ echo "ERROR"
+ exit 1;
+}
+
+has() {
+ type "$1" >/dev/null 2>&1
+}
+
+check_define() {
+ cat > $TMPC <<EOF
+#if !defined($1)
+#error $1 not defined
+#endif
+int main(void)
+{
+ return 0;
+}
+EOF
+ compile_object
+}
+
+targetos=""
+cpu=""
+
+cc="${CC-${cross_prefix}gcc}"
+
+if check_define __linux__ ; then
+ targetos="Linux"
+elif check_define _WIN32 ; then
+ targetos='MINGW32'
+elif check_define __OpenBSD__ ; then
+ targetos='OpenBSD'
+elif check_define __sun__ ; then
+ targetos='SunOS'
+else
+ targetos=`uname -s`
+fi
+
+# Some host OSes need non-standard checks for which CPU to use.
+# Note that these checks are broken for cross-compilation: if you're
+# cross-compiling to one of these OSes then you'll need to specify
+# the correct CPU with the --cpu option.
+case $targetos in
+Darwin)
+ # on Leopard most of the system is 32-bit, so we have to ask the kernel if
+ # we can run 64-bit userspace code.
+ # If the user didn't specify a CPU explicitly and the kernel says this is
+ # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
+ # detection code.
+ if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
+ cpu="x86_64"
+ fi
+ ;;
+SunOS)
+ # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
+ if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
+ cpu="x86_64"
+ fi
+esac
+
+if test ! -z "$cpu" ; then
+ # command line argument
+ :
+elif check_define __i386__ ; then
+ cpu="i386"
+elif check_define __x86_64__ ; then
+ cpu="x86_64"
+elif check_define __sparc__ ; then
+ if check_define __arch64__ ; then
+ cpu="sparc64"
+ else
+ cpu="sparc"
+ fi
+elif check_define _ARCH_PPC ; then
+ if check_define _ARCH_PPC64 ; then
+ cpu="ppc64"
+ else
+ cpu="ppc"
+ fi
+elif check_define __mips__ ; then
+ cpu="mips"
+elif check_define __ia64__ ; then
+ cpu="ia64"
+elif check_define __s390__ ; then
+ if check_define __s390x__ ; then
+ cpu="s390x"
+ else
+ cpu="s390"
+ fi
+elif check_define __arm__ ; then
+ cpu="arm"
+elif check_define __hppa__ ; then
+ cpu="hppa"
+else
+ cpu=`uname -m`
+fi
+
+# Normalise host CPU name and set ARCH.
+case "$cpu" in
+ ia64|ppc|ppc64|s390|s390x|sparc64)
+ cpu="$cpu"
+ ;;
+ i386|i486|i586|i686|i86pc|BePC)
+ cpu="i386"
+ ;;
+ x86_64|amd64)
+ cpu="x86_64"
+ ;;
+ armv*b|armv*l|arm)
+ cpu="arm"
+ ;;
+ hppa|parisc|parisc64)
+ cpu="hppa"
+ ;;
+ mips*)
+ cpu="mips"
+ ;;
+ sparc|sun4[cdmuv])
+ cpu="sparc"
+ ;;
+ *)
+ echo "Unknown CPU"
+ exit 1;
+ ;;
+esac
+
+if test -z $CC; then
+ if test "$targetos" = "FreeBSD"; then
+ if has clang; then
+ CC=clang
+ else
+ CC=gcc
+ fi
+ elif test "$targetos" = "MINGW32"; then
+ CC=x86_64-w64-mingw32-gcc
+ fi
+fi
+
+cc="${CC-${cross_prefix}gcc}"
+
+echo "Operating system $targetos"
+echo "CPU $cpu"
+echo "Compiler $cc"
+echo
+
+##########################################
+# check for wordsize
+wordsize="0"
+cat > $TMPC <<EOF
+#include <stdio.h>
+int main(void)
+{
+ unsigned int wsize = sizeof(long) * 8;
+ printf("%d\n", wsize);
+ return 0;
+}
+EOF
+if compile_prog "" "" "wordsize"; then
+ wordsize=$($TMPE)
+fi
+echo "Wordsize $wordsize"
+
+##########################################
+# linux-aio probe
+libaio="no"
+cat > $TMPC <<EOF
+#include <libaio.h>
+#include <stddef.h>
+int main(void)
+{
+ io_setup(0, NULL);
+ return 0;
+}
+EOF
+if compile_prog "" "-laio" "libaio" ; then
+ libaio=yes
+ LIBS="-laio $LIBS"
+else
+ if test "$libaio" = "yes" ; then
+ feature_not_found "linux AIO"
+ fi
+ libaio=no
+fi
+echo "Linux AIO support $libaio"
+
+##########################################
+# posix aio probe
+posix_aio="no"
+posix_aio_lrt="no"
+cat > $TMPC <<EOF
+#include <aio.h>
+int main(void)
+{
+ struct aiocb cb;
+ aio_read(&cb);
+ return 0;
+}
+EOF
+if compile_prog "" "" "posixaio" ; then
+ posix_aio="yes"
+elif compile_prog "" "-lrt" "posixaio"; then
+ posix_aio="yes"
+ posix_aio_lrt="yes"
+ LIBS="-lrt $LIBS"
+fi
+echo "POSIX AIO support $posix_aio"
+echo "POSIX AIO support needs -lrt $posix_aio_lrt"
+
+##########################################
+# posix aio fsync probe
+posix_aio_fsync="no"
+if test "$posix_aio" = "yes" ; then
+ cat > $TMPC <<EOF
+#include <fcntl.h>
+#include <aio.h>
+int main(void)
+{
+ struct aiocb cb;
+ return aio_fsync(O_SYNC, &cb);
+ return 0;
+}
+EOF
+ if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
+ posix_aio_fsync=yes
+ fi
+fi
+echo "POSIX AIO fsync $posix_aio_fsync"
+
+##########################################
+# solaris aio probe
+solaris_aio="no"
+cat > $TMPC <<EOF
+#include <sys/types.h>
+#include <sys/asynch.h>
+#include <unistd.h>
+int main(void)
+{
+ aio_result_t res;
+ return aioread(0, NULL, 0, 0, SEEK_SET, &res);
+ return 0;
+}
+EOF
+if compile_prog "" "-laio" "solarisaio" ; then
+ solaris_aio=yes
+ LIBS="-laio $LIBS"
+fi
+echo "Solaris AIO support $solaris_aio"
+
+##########################################
+# __sync_fetch_and_and test
+sfaa="no"
+cat > $TMPC << EOF
+static int sfaa(int *ptr)
+{
+ return __sync_fetch_and_and(ptr, 0);
+}
+
+int main(int argc, char **argv)
+{
+ int val = 42;
+ sfaa(&val);
+ return val;
+}
+EOF
+if compile_prog "" "" "__sync_fetch_and_add()" ; then
+ sfaa="yes"
+fi
+echo "__sync_fetch_and add $sfaa"
+
+##########################################
+# libverbs probe
+libverbs="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <infiniband/arch.h>
+int main(int argc, char **argv)
+{
+ struct ibv_pd *pd = ibv_alloc_pd(NULL);
+ return 0;
+}
+EOF
+if compile_prog "" "-libverbs" "libverbs" ; then
+ libverbs="yes"
+ LIBS="-libverbs $LIBS"
+fi
+echo "libverbs $libverbs"
+
+##########################################
+# rdmacm probe
+rdmacm="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <rdma/rdma_cma.h>
+int main(int argc, char **argv)
+{
+ rdma_destroy_qp(NULL);
+ return 0;
+}
+EOF
+if compile_prog "" "-lrdmacm" "rdma"; then
+ rdmacm="yes"
+ LIBS="-lrdmacm $LIBS"
+fi
+echo "rdmacm $rdmacm"
+
+##########################################
+# Linux fallocate probe
+linux_fallocate="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <linux/falloc.h>
+int main(int argc, char **argv)
+{
+ int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
+ return r;
+}
+EOF
+if compile_prog "" "" "linux_fallocate"; then
+ linux_fallocate="yes"
+fi
+echo "Linux fallocate $linux_fallocate"
+
+##########################################
+# POSIX fadvise probe
+posix_fadvise="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <fcntl.h>
+int main(int argc, char **argv)
+{
+ int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
+ return r;
+}
+EOF
+if compile_prog "" "" "posix_fadvise"; then
+ posix_fadvise="yes"
+fi
+echo "POSIX fadvise $posix_fadvise"
+
+##########################################
+# POSIX fallocate probe
+posix_fallocate="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <fcntl.h>
+int main(int argc, char **argv)
+{
+ int r = posix_fallocate(0, 0, 1024);
+ return r;
+}
+EOF
+if compile_prog "" "" "posix_fallocate"; then
+ posix_fallocate="yes"
+fi
+echo "POSIX fallocate $posix_fallocate"
+
+##########################################
+# sched_set/getaffinity 2 or 3 argument test
+linux_2arg_affinity="no"
+linux_3arg_affinity="no"
+cat > $TMPC << EOF
+#define _GNU_SOURCE
+#include <sched.h>
+int main(int argc, char **argv)
+{
+ cpu_set_t mask;
+ return sched_setaffinity(0, sizeof(mask), &mask);
+}
+EOF
+if compile_prog "" "" "sched_setaffinity(,,)"; then
+ linux_3arg_affinity="yes"
+else
+ cat > $TMPC << EOF
+#define _GNU_SOURCE
+#include <sched.h>
+int main(int argc, char **argv)
+{
+ cpu_set_t mask;
+ return sched_setaffinity(0, &mask);
+}
+EOF
+ if compile_prog "" "" "sched_setaffinity(,)"; then
+ linux_2arg_affinity="yes"
+ fi
+fi
+echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
+echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
+
+##########################################
+# clock_gettime probe
+clock_gettime="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <time.h>
+int main(int argc, char **argv)
+{
+ return clock_gettime(0, NULL);
+}
+EOF
+if compile_prog "" "" "clock_gettime"; then
+ clock_gettime="yes"
+elif compile_prog "" "-lrt" "clock_gettime"; then
+ clock_gettime="yes"
+ LIBS="-lrt $LIBS"
+fi
+echo "clock_gettime $clock_gettime"
+
+##########################################
+# CLOCK_MONOTONIC probe
+clock_monotonic="no"
+if test "$clock_gettime" = "yes" ; then
+ cat > $TMPC << EOF
+#include <stdio.h>
+#include <time.h>
+int main(int argc, char **argv)
+{
+ return clock_gettime(CLOCK_MONOTONIC, NULL);
+}
+EOF
+ if compile_prog "" "$LIBS" "clock monotonic"; then
+ clock_monotonic="yes"
+ fi
+fi
+echo "CLOCK_MONOTONIC $clock_monotonic"
+
+##########################################
+# CLOCK_MONOTONIC_PRECISE probe
+clock_monotonic_precise="no"
+if test "$clock_gettime" = "yes" ; then
+ cat > $TMPC << EOF
+#include <stdio.h>
+#include <time.h>
+int main(int argc, char **argv)
+{
+ return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
+}
+EOF
+ if compile_prog "" "$LIBS" "clock monotonic precise"; then
+ clock_monotonic_precise="yes"
+ fi
+fi
+echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
+
+##########################################
+# gettimeofday() probe
+gettimeofday="no"
+cat > $TMPC << EOF
+#include <sys/time.h>
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+ struct timeval tv;
+ return gettimeofday(&tv, NULL);
+}
+EOF
+if compile_prog "" "" "gettimeofday"; then
+ gettimeofday="yes"
+fi
+echo "gettimeofday $gettimeofday"
+
+##########################################
+# fdatasync() probe
+fdatasync="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <unistd.h>
+int main(int argc, char **argv)
+{
+ return fdatasync(0);
+}
+EOF
+if compile_prog "" "" "fdatasync"; then
+ fdatasync="yes"
+fi
+echo "fdatasync $fdatasync"
+
+##########################################
+# sync_file_range() probe
+sync_file_range="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <unistd.h>
+#define _GNU_SOURCE
+#include <fcntl.h>
+#include <linux/fs.h>
+int main(int argc, char **argv)
+{
+ unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
+ SYNC_FILE_RANGE_WAIT_AFTER;
+ return sync_file_range(0, 0, 0, flags);
+}
+EOF
+if compile_prog "" "" "sync_file_range"; then
+ sync_file_range="yes"
+fi
+echo "sync_file_range $sync_file_range"
+
+##########################################
+# ext4 move extent probe
+ext4_me="no"
+cat > $TMPC << EOF
+#include <fcntl.h>
+#include <sys/ioctl.h>
+int main(int argc, char **argv)
+{
+ struct move_extent me;
+ return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
+}
+EOF
+if compile_prog "" "" "ext4 move extent"; then
+ ext4_me="yes"
+fi
+echo "EXT4 move extent $ext4_me"
+
+##########################################
+# splice probe
+linux_splice="no"
+cat > $TMPC << EOF
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <fcntl.h>
+int main(int argc, char **argv)
+{
+ return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
+}
+EOF
+if compile_prog "" "" "linux splice"; then
+ linux_splice="yes"
+fi
+echo "Linux splice(2) $linux_splice"
+
+##########################################
+# GUASI probe
+guasi="no"
+cat > $TMPC << EOF
+#include <guasi.h>
+#include <guasi_syscalls.h>
+int main(int argc, char **argv)
+{
+ guasi_t ctx = guasi_create(0, 0, 0);
+ return 0;
+}
+EOF
+if compile_prog "" "" "guasi"; then
+ guasi="yes"
+fi
+echo "GUASI $guasi"
+
+##########################################
+# fusion-aw probe
+fusion_aw="no"
+cat > $TMPC << EOF
+#include <vsl_dp_experimental/vectored_write.h>
+int main(int argc, char **argv)
+{
+ struct vsl_iovec iov;
+ return vsl_vectored_write(0, &iov, 0, O_ATOMIC);
+}
+EOF
+if compile_prog "" "" "fusion-aw"; then
+ fusion_aw="yes"
+fi
+echo "Fusion-io atomic engine $fusion_aw"
+
+##########################################
+# libnuma probe
+libnuma="no"
+cat > $TMPC << EOF
+#include <numa.h>
+int main(int argc, char **argv)
+{
+ return numa_available();
+}
+EOF
+if compile_prog "" "-lnuma" "libnuma"; then
+ libnuma="yes"
+ LIBS="-lnuma $LIBS"
+fi
+echo "libnuma $libnuma"
+
+##########################################
+# strsep() probe
+strsep="no"
+cat > $TMPC << EOF
+#include <string.h>
+int main(int argc, char **argv)
+{
+ strsep(NULL, NULL);
+ return 0;
+}
+EOF
+if compile_prog "" "" "strsep"; then
+ strsep="yes"
+fi
+echo "strsep $strsep"
+
+##########################################
+# getopt_long_only() probe
+getopt_long_only="no"
+cat > $TMPC << EOF
+#include <unistd.h>
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+ int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
+ return c;
+}
+EOF
+if compile_prog "" "" "getopt_long_only"; then
+ getopt_long_only="yes"
+fi
+echo "getopt_long_only() $getopt_long_only"
+
+##########################################
+# inet_aton() probe
+inet_aton="no"
+cat > $TMPC << EOF
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+ struct in_addr in;
+ return inet_aton(NULL, &in);
+}
+EOF
+if compile_prog "" "" "inet_aton"; then
+ inet_aton="yes"
+fi
+echo "inet_aton $inet_aton"
+
+##########################################
+# socklen_t probe
+socklen_t="no"
+cat > $TMPC << EOF
+#include <string.h>
+#include <netinet/in.h>
+int main(int argc, char **argv)
+{
+ socklen_t len = 0;
+ return len;
+}
+EOF
+if compile_prog "" "" "socklen_t"; then
+ socklen_t="yes"
+fi
+echo "socklen_t $socklen_t"
+
+##########################################
+# Whether or not __thread is supported for TLS
+tls_thread="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+static int __thread ret;
+int main(int argc, char **argv)
+{
+ return ret;
+}
+EOF
+if compile_prog "" "" "__thread"; then
+ tls_thread="yes"
+fi
+echo "__thread $tls_thread"
+
+#############################################################################
+
+echo "# Automatically generated by configure - do not modify" > $config_host_mak
+printf "# Configured with:" >> $config_host_mak
+printf " '%s'" "$0" "$@" >> $config_host_mak
+echo >> $config_host_mak
+
+if test "$wordsize" = "64" ; then
+ echo "CONFIG_64BIT=y" >> $config_host_mak
+elif test "$wordsize" = "32" ; then
+ echo "CONFIG_32BIT=y" >> $config_host_mak
+else
+ echo "Unknown wordsize!"
+ exit 1
+fi
+if test "$libaio" = "yes" ; then
+ echo "CONFIG_LIBAIO=y" >> $config_host_mak
+fi
+if test "$posix_aio" = "yes" ; then
+ echo "CONFIG_POSIXAIO=y" >> $config_host_mak
+fi
+if test "$posix_aio_fsync" = "yes" ; then
+ echo "CONFIG_POSIXAIO_FSYNC=y" >> $config_host_mak
+fi
+if test "$linux_fallocate" = "yes" ; then
+ echo "CONFIG_LINUX_FALLOCATE=y" >> $config_host_mak
+fi
+if test "$posix_fallocate" = "yes" ; then
+ echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
+fi
+if test "$fdatasync" = "yes" ; then
+ echo "CONFIG_FDATASYNC=y" >> $config_host_mak
+fi
+if test "$sync_file_range" = "yes" ; then
+ echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
+fi
+if test "$sfaa" = "yes" ; then
+ echo "CONFIG_SFAA=y" >> $config_host_mak
+fi
+if test "$libverbs" = "yes" -o "rdmacm" = "yes" ; then
+ echo "CONFIG_RDMA=y" >> $config_host_mak
+fi
+if test "$clock_gettime" = "yes" ; then
+ echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak
+fi
+if test "$clock_monotonic" = "yes" ; then
+ echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak
+fi
+if test "$clock_monotonic_precise" = "yes" ; then
+ echo "CONFIG_CLOCK_MONOTONIC_PRECISE=y" >> $config_host_mak
+fi
+if test "$gettimeofday" = "yes" ; then
+ echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak
+fi
+if test "$posix_fadvise" = "yes" ; then
+ echo "CONFIG_POSIX_FADVISE=y" >> $config_host_mak
+fi
+if test "$linux_3arg_affinity" = "yes" ; then
+ echo "CONFIG_3ARG_AFFINITY=y" >> $config_host_mak
+elif test "$linux_2arg_affinity" = "yes" ; then
+ echo "CONFIG_2ARG_AFFINITY=y" >> $config_host_mak
+fi
+if test "$strsep" = "yes" ; then
+ echo "CONFIG_STRSEP=y" >> $config_host_mak
+fi
+if test "$getopt_long_only" = "yes" ; then
+ echo "CONFIG_GETOPT_LONG_ONLY=y" >> $config_host_mak
+fi
+if test "$inet_aton" = "yes" ; then
+ echo "CONFIG_INET_ATON=y" >> $config_host_mak
+fi
+if test "$socklen_t" = "yes" ; then
+ echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak
+fi
+if test "$ext4_me" = "yes" ; then
+ echo "CONFIG_LINUX_EXT4_MOVE_EXTENT=y" >> $config_host_mak
+fi
+if test "$linux_splice" = "yes" ; then
+ echo "CONFIG_LINUX_SPLICE=y" >> $config_host_mak
+fi
+if test "$guasi" = "yes" ; then
+ echo "CONFIG_GUASI=y" >> $config_host_mak
+fi
+if test "$fusion_aw" = "yes" ; then
+ echo "CONFIG_FUSION_AW=y" >> $config_host_mak
+fi
+if test "$libnuma" = "yes" ; then
+ echo "CONFIG_LIBNUMA=y" >> $config_host_mak
+fi
+if test "$solaris_aio" = "yes" ; then
+ echo "CONFIG_SOLARISAIO=y" >> $config_host_mak
+fi
+if test "$tls_thread" = "yes" ; then
+ echo "CONFIG_TLS_THREAD=y" >> $config_host_mak
+fi
+
+echo "LIBS+=$LIBS" >> $config_host_mak
+echo "CC=$cc" >> $config_host_mak
#include "../fio.h"
-#ifdef FIO_HAVE_FUSION_AW
-
#include <vsl_dp_experimental/vectored_write.h>
/* Fix sector size to 512 bytes independent of actual sector size, just like
.flags = FIO_SYNCIO | FIO_RAWIO | FIO_MEMALIGN
};
-#else /* !FUSION_HAVE_FUSION_AW */
-
-static int fio_fusion_aw_eng_init(struct thread_data fio_unused *td)
-{
- log_err("fio: fusion atomic write engine not available\n");
- return 1;
-}
-
-static struct ioengine_ops ioengine = {
- .name = "fusion-aw-sync",
- .version = FIO_IOOPS_VERSION,
- .init = fio_fusion_aw_eng_init,
-};
-
-#endif /* FUSION_HAVE_FUSION_AW */
-
static void fio_init fio_fusion_aw_init(void)
{
register_ioengine(&ioengine);
#include "../fio.h"
-#ifdef FIO_HAVE_GUASI
-
#define GFIO_MIN_THREADS 32
#ifndef GFIO_MAX_THREADS
#define GFIO_MAX_THREADS 2000
.get_file_size = generic_get_file_size,
};
-#else /* FIO_HAVE_GUASI */
-
-/*
- * When we have a proper configure system in place, we simply wont build
- * and install this io engine. For now install a crippled version that
- * just complains and fails to load.
- */
-static int fio_guasi_init(struct thread_data fio_unused *td)
-{
- log_err("fio: guasi not available\n");
- return 1;
-}
-
-static struct ioengine_ops ioengine = {
- .name = "guasi",
- .version = FIO_IOOPS_VERSION,
- .init = fio_guasi_init,
-};
-
-#endif
-
static void fio_init fio_guasi_register(void)
{
register_ioengine(&ioengine);
#include <unistd.h>
#include <errno.h>
#include <assert.h>
+#include <libaio.h>
#include "../fio.h"
-#ifdef FIO_HAVE_LIBAIO
-
struct libaio_data {
io_context_t aio_ctx;
struct io_event *aio_events;
.option_struct_size = sizeof(struct libaio_options),
};
-#else /* FIO_HAVE_LIBAIO */
-
-/*
- * When we have a proper configure system in place, we simply wont build
- * and install this io engine. For now install a crippled version that
- * just complains and fails to load.
- */
-static int fio_libaio_init(struct thread_data fio_unused *td)
-{
- log_err("fio: libaio not available\n");
- return 1;
-}
-
-static struct ioengine_ops ioengine = {
- .name = "libaio",
- .version = FIO_IOOPS_VERSION,
- .init = fio_libaio_init,
-};
-
-#endif
-
static void fio_init fio_libaio_register(void)
{
register_ioengine(&ioengine);
return 0;
}
-#ifdef FIO_HAVE_SPLICE
+#ifdef CONFIG_LINUX_SPLICE
static int splice_io_u(int fdin, int fdout, unsigned int len)
{
int bytes = 0;
do {
if (o->proto == FIO_TYPE_UDP) {
- fio_socklen_t len = sizeof(nd->addr);
+ socklen_t len = sizeof(nd->addr);
struct sockaddr *from = (struct sockaddr *) &nd->addr;
ret = recvfrom(io_u->file->fd, io_u->xfer_buf,
if (o->proto == FIO_TYPE_UDP)
return 0;
else if (o->proto == FIO_TYPE_TCP) {
- fio_socklen_t len = sizeof(nd->addr);
+ socklen_t len = sizeof(nd->addr);
if (connect(f->fd, (struct sockaddr *) &nd->addr, len) < 0) {
td_verror(td, errno, "connect");
}
} else {
struct sockaddr_un *addr = &nd->addr_un;
- fio_socklen_t len;
+ socklen_t len;
len = sizeof(addr->sun_family) + strlen(addr->sun_path) + 1;
{
struct netio_data *nd = td->io_ops->data;
struct netio_options *o = td->eo;
- fio_socklen_t socklen = sizeof(nd->addr);
+ socklen_t socklen = sizeof(nd->addr);
int state;
if (o->proto == FIO_TYPE_UDP) {
struct netio_data *nd = td->io_ops->data;
struct udp_close_msg msg;
struct sockaddr *to = (struct sockaddr *) &nd->addr;
- fio_socklen_t len = sizeof(nd->addr);
+ socklen_t len = sizeof(nd->addr);
int ret;
ret = recvfrom(f->fd, &msg, sizeof(msg), MSG_WAITALL, to, &len);
kill(td->pid, SIGUSR2);
}
-#ifdef FIO_HAVE_SPLICE
+#ifdef CONFIG_LINUX_SPLICE
static int fio_netio_setup_splice(struct thread_data *td)
{
struct netio_data *nd;
static void fio_init fio_netio_register(void)
{
register_ioengine(&ioengine_rw);
-#ifdef FIO_HAVE_SPLICE
+#ifdef CONFIG_LINUX_SPLICE
register_ioengine(&ioengine_splice);
#endif
}
static void fio_exit fio_netio_unregister(void)
{
unregister_ioengine(&ioengine_rw);
-#ifdef FIO_HAVE_SPLICE
+#ifdef CONFIG_LINUX_SPLICE
unregister_ioengine(&ioengine_splice);
#endif
}
#include "../fio.h"
-#ifdef FIO_HAVE_POSIXAIO
-
struct posixaio_data {
struct io_u **aio_events;
unsigned int queued;
do_io_u_trim(td, io_u);
return FIO_Q_COMPLETED;
} else {
-#ifdef FIO_HAVE_POSIXAIO_FSYNC
+#ifdef CONFIG_POSIXAIO_FSYNC
ret = aio_fsync(O_SYNC, aiocb);
#else
if (pd->queued)
.get_file_size = generic_get_file_size,
};
-#else /* FIO_HAVE_POSIXAIO */
-
-/*
- * When we have a proper configure system in place, we simply wont build
- * and install this io engine. For now install a crippled version that
- * just complains and fails to load.
- */
-static int fio_posixaio_init(struct thread_data fio_unused *td)
-{
- log_err("fio: posixaio not available\n");
- return 1;
-}
-
-static struct ioengine_ops ioengine = {
- .name = "posixaio",
- .version = FIO_IOOPS_VERSION,
- .init = fio_posixaio_init,
-};
-
-#endif
-
static void fio_init fio_posixaio_register(void)
{
register_ioengine(&ioengine);
#include "../fio.h"
#include "../hash.h"
-#ifdef FIO_HAVE_RDMA
-
#include <rdma/rdma_cma.h>
#include <infiniband/arch.h>
.flags = FIO_DISKLESSIO | FIO_UNIDIR | FIO_PIPEIO,
};
-#else /* FIO_HAVE_RDMA */
-
-static int fio_rdmaio_open_file(struct thread_data *td, struct fio_file *f)
-{
- return 0;
-}
-
-static int fio_rdmaio_close_file(struct thread_data *td, struct fio_file *f)
-{
- return 0;
-}
-
-static int fio_rdmaio_queue(struct thread_data *td, struct io_u *io_u)
-{
- return FIO_Q_COMPLETED;
-}
-
-static int fio_rdmaio_init(struct thread_data fio_unused * td)
-{
- log_err("fio: rdma(librdmacm libibverbs) not available\n");
- log_err(" You haven't compiled rdma ioengine into fio.\n");
- log_err(" If you want to try rdma ioengine,\n");
- log_err(" make sure OFED is installed,\n");
- log_err(" $ ofed_info\n");
- log_err(" then try to make fio as follows:\n");
- log_err(" $ export EXTFLAGS+=\" -DFIO_HAVE_RDMA \"\n");
- log_err(" $ export EXTLIBS+=\" -libverbs -lrdmacm \"\n");
- log_err(" $ make clean && make\n");
- return 1;
-}
-
-static struct ioengine_ops ioengine_rw = {
- .name = "rdma",
- .version = FIO_IOOPS_VERSION,
- .init = fio_rdmaio_init,
- .queue = fio_rdmaio_queue,
- .open_file = fio_rdmaio_open_file,
- .close_file = fio_rdmaio_close_file,
- .flags = FIO_SYNCIO | FIO_DISKLESSIO | FIO_UNIDIR | FIO_PIPEIO,
-};
-
-#endif
-
static void fio_init fio_rdmaio_register(void)
{
register_ioengine(&ioengine_rw);
#include "../fio.h"
-#ifdef FIO_HAVE_SOLARISAIO
-
#include <sys/asynch.h>
struct solarisaio_data {
.get_file_size = generic_get_file_size,
};
-#else /* FIO_HAVE_SOLARISAIO */
-
-/*
- * When we have a proper configure system in place, we simply wont build
- * and install this io engine. For now install a crippled version that
- * just complains and fails to load.
- */
-static int fio_solarisaio_init(struct thread_data fio_unused *td)
-{
- log_err("fio: solarisaio not available\n");
- return 1;
-}
-
-static struct ioengine_ops ioengine = {
- .name = "solarisaio",
- .version = FIO_IOOPS_VERSION,
- .init = fio_solarisaio_init,
-};
-
-#endif
-
static void fio_init fio_solarisaio_register(void)
{
register_ioengine(&ioengine);
#include "../fio.h"
-#ifdef FIO_HAVE_SPLICE
-
struct spliceio_data {
int pipe[2];
int vmsplice_to_user;
.flags = FIO_SYNCIO | FIO_PIPEIO,
};
-#else /* FIO_HAVE_SPLICE */
-
-/*
- * When we have a proper configure system in place, we simply wont build
- * and install this io engine. For now install a crippled version that
- * just complains and fails to load.
- */
-static int fio_spliceio_init(struct thread_data fio_unused *td)
-{
- log_err("fio: splice not available\n");
- return 1;
-}
-
-static struct ioengine_ops ioengine = {
- .name = "splice",
- .version = FIO_IOOPS_VERSION,
- .init = fio_spliceio_init,
-};
-
-#endif
-
static void fio_init fio_spliceio_register(void)
{
register_ioengine(&ioengine);
+++ /dev/null
-/*
- * syslet engine
- *
- * IO engine that does regular pread(2)/pwrite(2) to transfer data, but
- * with syslets to make the execution async.
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <assert.h>
-#include <malloc.h>
-#include <asm/unistd.h>
-
-#include "../fio.h"
-#include "../lib/fls.h"
-
-#ifdef FIO_HAVE_SYSLET
-
-#ifdef __NR_pread64
-#define __NR_fio_pread __NR_pread64
-#define __NR_fio_pwrite __NR_pwrite64
-#else
-#define __NR_fio_pread __NR_pread
-#define __NR_fio_pwrite __NR_pwrite
-#endif
-
-struct syslet_data {
- struct io_u **events;
- unsigned int nr_events;
-
- struct syslet_ring *ring;
- unsigned int ring_mask;
- void *stack;
-};
-
-static void fio_syslet_add_event(struct thread_data *td, struct io_u *io_u)
-{
- struct syslet_data *sd = td->io_ops->data;
-
- assert(sd->nr_events < td->o.iodepth);
- sd->events[sd->nr_events++] = io_u;
-}
-
-static void fio_syslet_add_events(struct thread_data *td, unsigned int nr)
-{
- struct syslet_data *sd = td->io_ops->data;
- unsigned int i, uidx;
-
- uidx = sd->ring->user_tail;
- read_barrier();
-
- for (i = 0; i < nr; i++) {
- unsigned int idx = (i + uidx) & sd->ring_mask;
- struct syslet_completion *comp = &sd->ring->comp[idx];
- struct io_u *io_u = (struct io_u *) (long) comp->caller_data;
- long ret;
-
- ret = comp->status;
- if (ret <= 0) {
- io_u->resid = io_u->xfer_buflen;
- io_u->error = -ret;
- } else {
- io_u->resid = io_u->xfer_buflen - ret;
- io_u->error = 0;
- }
-
- fio_syslet_add_event(td, io_u);
- }
-}
-
-static void fio_syslet_wait_for_events(struct thread_data *td)
-{
- struct syslet_data *sd = td->io_ops->data;
- struct syslet_ring *ring = sd->ring;
-
- do {
- unsigned int kh = ring->kernel_head;
- int ret;
-
- /*
- * first reap events that are already completed
- */
- if (ring->user_tail != kh) {
- unsigned int nr = kh - ring->user_tail;
-
- fio_syslet_add_events(td, nr);
- ring->user_tail = kh;
- break;
- }
-
- /*
- * block waiting for at least one event
- */
- ret = syscall(__NR_syslet_ring_wait, ring, ring->user_tail);
- assert(!ret);
- } while (1);
-}
-
-static int fio_syslet_getevents(struct thread_data *td, unsigned int min,
- unsigned int fio_unused max,
- struct timespec fio_unused *t)
-{
- struct syslet_data *sd = td->io_ops->data;
- long ret;
-
- /*
- * While we have less events than requested, block waiting for them
- * (if we have to, there may already be more completed events ready
- * for us - see fio_syslet_wait_for_events()
- */
- while (sd->nr_events < min)
- fio_syslet_wait_for_events(td);
-
- ret = sd->nr_events;
- sd->nr_events = 0;
- return ret;
-}
-
-static struct io_u *fio_syslet_event(struct thread_data *td, int event)
-{
- struct syslet_data *sd = td->io_ops->data;
-
- return sd->events[event];
-}
-
-static void fio_syslet_prep_sync(struct fio_file *f,
- struct indirect_registers *regs)
-{
- FILL_IN(*regs, __NR_fsync, (long) f->fd);
-}
-
-static void fio_syslet_prep_datasync(struct fio_file *f,
- struct indirect_registers *regs)
-{
- FILL_IN(*regs, __NR_fdatasync, (long) f->fd);
-}
-
-static void fio_syslet_prep_rw(struct io_u *io_u, struct fio_file *f,
- struct indirect_registers *regs)
-{
- long nr;
-
- /*
- * prepare rw
- */
- if (io_u->ddir == DDIR_READ)
- nr = __NR_fio_pread;
- else
- nr = __NR_fio_pwrite;
-
- FILL_IN(*regs, nr, (long) f->fd, (long) io_u->xfer_buf,
- (long) io_u->xfer_buflen, (long) io_u->offset);
-}
-
-static void fio_syslet_prep(struct io_u *io_u, struct indirect_registers *regs)
-{
- struct fio_file *f = io_u->file;
-
- if (io_u->ddir == DDIR_SYNC)
- fio_syslet_prep_sync(f, regs);
- else if (io_u->ddir == DDIR_DATASYNC)
- fio_syslet_prep_datasync(f, regs);
- else
- fio_syslet_prep_rw(io_u, f, regs);
-}
-
-static void ret_func(void)
-{
- syscall(__NR_exit);
-}
-
-static int fio_syslet_queue(struct thread_data *td, struct io_u *io_u)
-{
- struct syslet_data *sd = td->io_ops->data;
- union indirect_params params;
- struct indirect_registers regs;
- int ret;
-
- fio_ro_check(td, io_u);
-
- memset(¶ms, 0, sizeof(params));
- fill_syslet_args(¶ms.syslet, sd->ring, (long)io_u, ret_func, sd->stack);
-
- fio_syslet_prep(io_u, ®s);
-
- ret = syscall(__NR_indirect, ®s, ¶ms, sizeof(params), 0);
- if (ret == (int) io_u->xfer_buflen) {
- /*
- * completed sync, account. this also catches fsync().
- */
- return FIO_Q_COMPLETED;
- } else if (ret < 0) {
- /*
- * queued for async execution
- */
- if (errno == ESYSLETPENDING)
- return FIO_Q_QUEUED;
- }
-
- io_u->error = errno;
- td_verror(td, io_u->error, "xfer");
- return FIO_Q_COMPLETED;
-}
-
-static int check_syslet_support(struct syslet_data *sd)
-{
- union indirect_params params;
- struct indirect_registers regs;
- pid_t pid, my_pid = getpid();
-
- memset(¶ms, 0, sizeof(params));
- fill_syslet_args(¶ms.syslet, sd->ring, 0, ret_func, sd->stack);
-
- FILL_IN(regs, __NR_getpid);
-
- pid = syscall(__NR_indirect, ®s, ¶ms, sizeof(params), 0);
- if (pid == my_pid)
- return 0;
-
- return 1;
-}
-
-static void fio_syslet_cleanup(struct thread_data *td)
-{
- struct syslet_data *sd = td->io_ops->data;
-
- if (sd) {
- free(sd->events);
- free(sd->ring);
- free(sd);
- }
-}
-
-static int fio_syslet_init(struct thread_data *td)
-{
- struct syslet_data *sd;
- void *ring = NULL, *stack = NULL;
- unsigned int ring_size, ring_nr;
-
- sd = malloc(sizeof(*sd));
- memset(sd, 0, sizeof(*sd));
-
- sd->events = malloc(sizeof(struct io_u *) * td->o.iodepth);
- memset(sd->events, 0, sizeof(struct io_u *) * td->o.iodepth);
-
- /*
- * The ring needs to be a power-of-2, so round it up if we have to
- */
- ring_nr = td->o.iodepth;
- if (ring_nr & (ring_nr - 1))
- ring_nr = 1 << __fls(ring_nr);
-
- ring_size = sizeof(struct syslet_ring) +
- ring_nr * sizeof(struct syslet_completion);
- if (posix_memalign(&ring, sizeof(uint64_t), ring_size))
- goto err_mem;
- if (posix_memalign(&stack, page_size, page_size))
- goto err_mem;
-
- sd->ring = ring;
- sd->ring_mask = ring_nr - 1;
- sd->stack = stack;
-
- memset(sd->ring, 0, ring_size);
- sd->ring->elements = ring_nr;
-
- if (!check_syslet_support(sd)) {
- td->io_ops->data = sd;
- return 0;
- }
-
- log_err("fio: syslets do not appear to work\n");
-err_mem:
- free(sd->events);
- if (ring)
- free(ring);
- if (stack)
- free(stack);
- free(sd);
- return 1;
-}
-
-static struct ioengine_ops ioengine = {
- .name = "syslet-rw",
- .version = FIO_IOOPS_VERSION,
- .init = fio_syslet_init,
- .queue = fio_syslet_queue,
- .getevents = fio_syslet_getevents,
- .event = fio_syslet_event,
- .cleanup = fio_syslet_cleanup,
- .open_file = generic_open_file,
- .close_file = generic_close_file,
- .get_file_size = generic_get_file_size,
-};
-
-#else /* FIO_HAVE_SYSLET */
-
-/*
- * When we have a proper configure system in place, we simply wont build
- * and install this io engine. For now install a crippled version that
- * just complains and fails to load.
- */
-static int fio_syslet_init(struct thread_data fio_unused *td)
-{
- log_err("fio: syslet not available\n");
- return 1;
-}
-
-static struct ioengine_ops ioengine = {
- .name = "syslet-rw",
- .version = FIO_IOOPS_VERSION,
- .init = fio_syslet_init,
-};
-
-#endif /* FIO_HAVE_SYSLET */
-
-static void fio_init fio_syslet_register(void)
-{
- register_ioengine(&ioengine);
-}
-
-static void fio_exit fio_syslet_unregister(void)
-{
- unregister_ioengine(&ioengine);
-}
return 1;
}
+#if !defined(CONFIG_GETTIMEOFDAY) && !defined(CONFIG_CLOCK_GETTIME)
+#error "No available clock source!"
+#endif
+
arch_init(envp);
sinit();
#include "stat.h"
#include "flow.h"
-#ifdef FIO_HAVE_GUASI
-#include <guasi.h>
-#endif
-
#ifdef FIO_HAVE_SOLARISAIO
#include <sys/asynch.h>
#endif
-#ifdef FIO_HAVE_LIBNUMA
+#ifdef CONFIG_LIBNUMA
#include <linux/mempolicy.h>
#include <numa.h>
unsigned int cpumask_set;
os_cpu_mask_t verify_cpumask;
unsigned int verify_cpumask_set;
-#ifdef FIO_HAVE_LIBNUMA
+#ifdef CONFIG_LIBNUMA
struct bitmask *numa_cpunodesmask;
unsigned int numa_cpumask_set;
unsigned short numa_mem_mode;
int last_tv_valid;
unsigned long last_cycles;
};
+#ifdef CONFIG_TLS_THREAD
+static struct tv_valid __thread static_tv_valid;
+#else
static pthread_key_t tv_tls_key;
+#endif
enum fio_cs fio_clock_source = FIO_PREFERRED_CLOCK_SOURCE;
int fio_clock_source_set = 0;
#endif /* FIO_DEBUG_TIME */
+#ifdef CONFIG_CLOCK_GETTIME
static int fill_clock_gettime(struct timespec *ts)
{
-#ifdef FIO_HAVE_CLOCK_MONOTONIC
+#ifdef CONFIG_CLOCK_MONOTONIC
return clock_gettime(CLOCK_MONOTONIC, ts);
#else
return clock_gettime(CLOCK_REALTIME, ts);
#endif
}
-
-#ifdef FIO_DEBUG_TIME
-void fio_gettime(struct timeval *tp, void *caller)
-#else
-void fio_gettime(struct timeval *tp, void fio_unused *caller)
#endif
+
+static void *__fio_gettime(struct timeval *tp)
{
struct tv_valid *tv;
-#ifdef FIO_DEBUG_TIME
- if (!caller)
- caller = __builtin_return_address(0);
-
- gtod_log_caller(caller);
-#endif
- if (fio_tv) {
- memcpy(tp, fio_tv, sizeof(*tp));
- return;
- }
-
+#ifdef CONFIG_TLS_THREAD
+ tv = &static_tv_valid;
+#else
tv = pthread_getspecific(tv_tls_key);
+#endif
switch (fio_clock_source) {
+#ifdef CONFIG_GETTIMEOFDAY
case CS_GTOD:
gettimeofday(tp, NULL);
break;
+#endif
+#ifdef CONFIG_CLOCK_GETTIME
case CS_CGETTIME: {
struct timespec ts;
tp->tv_usec = ts.tv_nsec / 1000;
break;
}
+#endif
#ifdef ARCH_HAVE_CPU_CLOCK
case CS_CPUCLOCK: {
unsigned long long usecs, t;
break;
}
+ return tv;
+}
+
+#ifdef FIO_DEBUG_TIME
+void fio_gettime(struct timeval *tp, void *caller)
+#else
+void fio_gettime(struct timeval *tp, void fio_unused *caller)
+#endif
+{
+ struct tv_valid *tv;
+
+#ifdef FIO_DEBUG_TIME
+ if (!caller)
+ caller = __builtin_return_address(0);
+
+ gtod_log_caller(caller);
+#endif
+ if (fio_tv) {
+ memcpy(tp, fio_tv, sizeof(*tp));
+ return;
+ }
+
+ tv = __fio_gettime(tp);
+
/*
* If Linux is using the tsc clock on non-synced processors,
* sometimes time can appear to drift backwards. Fix that up.
#ifdef ARCH_HAVE_CPU_CLOCK
static unsigned long get_cycles_per_usec(void)
{
- struct timespec ts;
struct timeval s, e;
unsigned long long c_s, c_e;
+ enum fio_cs old_cs = fio_clock_source;
- fill_clock_gettime(&ts);
- s.tv_sec = ts.tv_sec;
- s.tv_usec = ts.tv_nsec / 1000;
+#ifdef CONFIG_CLOCK_GETTIME
+ fio_clock_source = CS_CGETTIME;
+#else
+ fio_clock_source = CS_GTOD;
+#endif
+ __fio_gettime(&s);
c_s = get_cpu_clock();
do {
unsigned long long elapsed;
- fill_clock_gettime(&ts);
- e.tv_sec = ts.tv_sec;
- e.tv_usec = ts.tv_nsec / 1000;
+ __fio_gettime(&e);
elapsed = utime_since(&s, &e);
if (elapsed >= 1280) {
}
} while (1);
+ fio_clock_source = old_cs;
return (c_e - c_s + 127) >> 7;
}
}
#endif
+#ifndef CONFIG_TLS_THREAD
void fio_local_clock_init(int is_thread)
{
struct tv_valid *t;
{
free(data);
}
+#else
+void fio_local_clock_init(int is_thread)
+{
+}
+#endif
void fio_clock_init(void)
{
if (fio_clock_source == fio_clock_source_inited)
return;
+#ifndef CONFIG_TLS_THREAD
if (pthread_key_create(&tv_tls_key, kill_tv_tls_key))
log_err("fio: can't create TLS key\n");
+#endif
fio_clock_source_inited = fio_clock_source;
calibrate_cpu_clock();
return mtime_since_now(s) / 1000;
}
-#if defined(FIO_HAVE_CPU_AFFINITY) && defined(ARCH_HAVE_CPU_CLOCK)
+#if defined(FIO_HAVE_CPU_AFFINITY) && defined(ARCH_HAVE_CPU_CLOCK) && \
+ defined(CONFIG_SFAA)
#define CLOCK_ENTRIES 100000
#include "arch/arch.h"
#include "os/os.h"
-#ifndef FIO_HAVE_LINUX_FALLOCATE
-int _weak fallocate(int fd, int mode, off_t offset, off_t len)
+#ifndef CONFIG_LINUX_FALLOCATE
+int fallocate(int fd, int mode, off_t offset, off_t len)
{
errno = ENOSYS;
return -1;
}
#endif
-#ifndef __NR_fallocate
-int _weak posix_fallocate(int fd, off_t offset, off_t len)
+#ifndef CONFIG_POSIX_FALLOCATE
+int posix_fallocate(int fd, off_t offset, off_t len)
{
return 0;
}
#endif
-int _weak inet_aton(const char *cp, struct in_addr *inp)
-{
- return 0;
-}
-
-int _weak clock_gettime(clockid_t clk_id, struct timespec *ts)
-{
- struct timeval tv;
- int ret;
-
- ret = gettimeofday(&tv, NULL);
-
- ts->tv_sec = tv.tv_sec;
- ts->tv_nsec = tv.tv_usec * 1000;
-
- return ret;
-}
-
-#ifndef __NR_sync_file_range
-int _weak sync_file_range(int fd, off64_t offset, off64_t nbytes,
- unsigned int flags)
+#ifndef CONFIG_SYNC_FILE_RANGE
+int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
{
errno = ENOSYS;
return -1;
}
#endif
-#ifndef FIO_HAVE_FADVISE
-int _weak posix_fadvise(int fd, off_t offset, off_t len, int advice)
+#ifndef CONFIG_FADVISE
+int posix_fadvise(int fd, off_t offset, off_t len, int advice)
{
return 0;
}
#include <sys/types.h>
#include <time.h>
-struct in_addr;
-
-extern int _weak fallocate(int fd, int mode, off_t offset, off_t len);
-extern int _weak posix_memalign(void **ptr, size_t align, size_t size);
-extern int _weak posix_fallocate(int fd, off_t offset, off_t len);
-extern int _weak inet_aton(const char *cp, struct in_addr *inp);
-extern int _weak clock_gettime(clockid_t clk_id, struct timespec *ts);
-extern int _weak sync_file_range(int fd, off64_t offset, off64_t nbytes,
+extern int fallocate(int fd, int mode, off_t offset, off_t len);
+extern int posix_fallocate(int fd, off_t offset, off_t len);
+extern int sync_file_range(int fd, off64_t offset, off64_t nbytes,
unsigned int flags);
-extern int _weak posix_fadvise(int fd, off_t offset, off_t len, int advice);
+extern int posix_fadvise(int fd, off_t offset, off_t len, int advice);
#endif /* FIO_HELPERS_H_ */
/*
* The low water mark cannot be bigger than the iodepth
*/
- if (o->iodepth_low > o->iodepth || !o->iodepth_low) {
- /*
- * syslet work around - if the workload is sequential,
- * we want to let the queue drain all the way down to
- * avoid seeking between async threads
- */
- if (!strcmp(td->io_ops->name, "syslet-rw") && !td_random(td))
- o->iodepth_low = 1;
- else
- o->iodepth_low = o->iodepth;
- }
+ if (o->iodepth_low > o->iodepth || !o->iodepth_low)
+ o->iodepth_low = o->iodepth;
/*
* If batch number isn't set, default to the same as iodepth
}
}
-#ifndef FIO_HAVE_FDATASYNC
+#ifndef CONFIG_FDATASYNC
if (o->fdatasync_blocks) {
log_info("fio: this platform does not support fdatasync()"
" falling back to using fsync(). Use the 'fsync'"
#ifndef FIO_IOENGINE_H
#define FIO_IOENGINE_H
+#ifdef CONFIG_LIBAIO
+#include <libaio.h>
+#endif
+#ifdef CONFIG_GUASI
+#include <guasi.h>
+#endif
+
#define FIO_IOOPS_VERSION 14
enum {
*/
struct io_u {
union {
-#ifdef FIO_HAVE_LIBAIO
+#ifdef CONFIG_LIBAIO
struct iocb iocb;
#endif
-#ifdef FIO_HAVE_POSIXAIO
+#ifdef CONFIG_POSIXAIO
os_aiocb_t aiocb;
#endif
#ifdef FIO_HAVE_SGIO
struct sg_io_hdr hdr;
#endif
-#ifdef FIO_HAVE_GUASI
+#ifdef CONFIG_GUASI
guasi_req_t greq;
#endif
-#ifdef FIO_HAVE_SOLARISAIO
+#ifdef CONFIG_SOLARISAIO
aio_result_t resultp;
#endif
#ifdef FIO_HAVE_BINJECT
struct b_user_cmd buc;
#endif
-#ifdef FIO_HAVE_RDMA
+#ifdef CONFIG_RDMA
struct ibv_mr *mr;
#endif
void *mmap_data;
if (io_u->ddir == DDIR_SYNC) {
ret = fsync(io_u->file->fd);
} else if (io_u->ddir == DDIR_DATASYNC) {
-#ifdef FIO_HAVE_FDATASYNC
+#ifdef CONFIG_FDATASYNC
ret = fdatasync(io_u->file->fd);
#else
ret = io_u->xfer_buflen;
-#if !(defined(_AIX) || defined(__hpux))
+#ifndef CONFIG_GETOPT_LONG_ONLY
#include <getopt.h>
-#else /* _AIX || __hpux */
+#else
#ifndef _GETOPT_H
#define _GETOPT_H
int getopt_long_only(int, char *const *, const char *, const struct option *, int *);
-#endif /* _GETOPT_H */
-#endif /* _AIX || __hpux */
+#endif
+#endif
--- /dev/null
+#include "inet_aton.h"
+
+int inet_aton(const char *cp, struct in_addr *inp)
+{
+ return inet_pton(AF_INET, cp, inp);
+}
--- /dev/null
+#ifndef FIO_INET_ATON_LIB_H
+#define FIO_INET_ATON_LIB_H
+
+#include <arpa/inet.h>
+
+int inet_aton(const char *cp, struct in_addr *inp);
+
+#endif
-#ifndef FIO_LIB_H
-#define FIO_LIB_H
+#ifndef FIO_STRSEP_LIB_H
+#define FIO_STRSEP_LIB_H
char *strsep(char **, const char *);
}
#endif
-#ifdef FIO_HAVE_LIBNUMA
+#ifdef CONFIG_LIBNUMA
static int str_numa_cpunodes_cb(void *data, char *input)
{
struct thread_data *td = data;
return 0;
}
-#ifdef FIO_HAVE_SYNC_FILE_RANGE
+#ifdef CONFIG_SYNC_FILE_RANGE
static int str_sfr_cb(void *data, const char *str)
{
struct thread_data *td = data;
{ .ival = "vsync",
.help = "Use readv/writev",
},
-#ifdef FIO_HAVE_LIBAIO
+#ifdef CONFIG_LIBAIO
{ .ival = "libaio",
.help = "Linux native asynchronous IO",
},
#endif
-#ifdef FIO_HAVE_POSIXAIO
+#ifdef CONFIG_POSIXAIO
{ .ival = "posixaio",
.help = "POSIX asynchronous IO",
},
{ .ival = "mmap",
.help = "Memory mapped IO"
},
-#ifdef FIO_HAVE_SPLICE
+#ifdef CONFIG_LINUX_SPLICE
{ .ival = "splice",
.help = "splice/vmsplice based IO",
},
{ .ival = "net",
.help = "Network IO",
},
-#ifdef FIO_HAVE_SYSLET
- { .ival = "syslet-rw",
- .help = "syslet enabled async pread/pwrite IO",
- },
-#endif
{ .ival = "cpuio",
.help = "CPU cycle burner engine",
},
-#ifdef FIO_HAVE_GUASI
+#ifdef CONFIG_GUASI
{ .ival = "guasi",
.help = "GUASI IO engine",
},
.help = "binject direct inject block engine",
},
#endif
-#ifdef FIO_HAVE_RDMA
+#ifdef CONFIG_RDMA
{ .ival = "rdma",
.help = "RDMA IO engine",
},
#endif
-#ifdef FIO_HAVE_FUSION_AW
+#ifdef CONFIG_FUSION_AW
{ .ival = "fusion-aw-sync",
.help = "Fusion-io atomic write engine",
},
.help = "Make every Nth write a barrier write",
.def = "0",
},
-#ifdef FIO_HAVE_SYNC_FILE_RANGE
+#ifdef CONFIG_SYNC_FILE_RANGE
{
.name = "sync_file_range",
.posval = {
.off1 = td_var_offset(clocksource),
.help = "What type of timing source to use",
.posval = {
+#ifdef CONFIG_GETTIMEOFDAY
{ .ival = "gettimeofday",
.oval = CS_GTOD,
.help = "Use gettimeofday(2) for timing",
},
+#endif
+#ifdef CONFIG_CLOCK_GETTIME
{ .ival = "clock_gettime",
.oval = CS_CGETTIME,
.help = "Use clock_gettime(2) for timing",
},
+#endif
#ifdef ARCH_HAVE_CPU_CLOCK
{ .ival = "cpu",
.oval = CS_CPUCLOCK,
.help = "Set CPUs allowed",
},
#endif
-#ifdef FIO_HAVE_LIBNUMA
+#ifdef CONFIG_LIBNUMA
{
.name = "numa_cpu_nodes",
.type = FIO_OPT_STR,
+++ /dev/null
-#ifndef _INDIRECT_H_
-#define _INDIRECT_H_
-
-#include "syslet.h"
-
-union indirect_params {
- struct {
- u32 flags;
- } file_flags;
- struct syslet_args syslet;
-};
-
-#ifdef __x86_64__
-# define __NR_indirect 286
-struct indirect_registers {
- u64 rax;
- u64 rdi;
- u64 rsi;
- u64 rdx;
- u64 r10;
- u64 r8;
- u64 r9;
-};
-#elif defined __i386__
-# define __NR_indirect 325
-struct indirect_registers {
- u32 eax;
- u32 ebx;
- u32 ecx;
- u32 edx;
- u32 esi;
- u32 edi;
- u32 ebp;
-};
-#endif
-
-#define FILL_IN(var, values...) \
- (var) = (struct indirect_registers) { values, }
-
-#endif
#include "../file.h"
-#define FIO_HAVE_POSIXAIO
#define FIO_HAVE_ODIRECT
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
-#define FIO_HAVE_CLOCK_MONOTONIC
-
-/*
- * This is broken on AIX if _LARGE_FILES is defined...
- */
-#if 0
-#define FIO_HAVE_FALLOCATE
-#endif
#define FIO_HAVE_PSHARED_MUTEX
#define FIO_USE_GENERIC_SWAP
-#define FIO_OS_HAVE_SOCKLEN_T
-#define fio_socklen_t socklen_t
-
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
return EINVAL;
#include <linux/major.h>
#include <endian.h>
-#include "indirect.h"
#include "binject.h"
#include "../file.h"
#define FIO_HAVE_DISK_UTIL
-#define FIO_HAVE_SPLICE
#define FIO_HAVE_IOSCHED_SWITCH
#define FIO_HAVE_ODIRECT
#define FIO_HAVE_HUGETLB
#define FIO_HAVE_BLKTRACE
-#define FIO_HAVE_STRSEP
-#define FIO_HAVE_POSIXAIO_FSYNC
#define FIO_HAVE_PSHARED_MUTEX
#define FIO_HAVE_CL_SIZE
-#define FIO_HAVE_FDATASYNC
#define FIO_HAVE_FS_STAT
#define FIO_HAVE_TRIM
-#define FIO_HAVE_CLOCK_MONOTONIC
#define FIO_HAVE_GETTID
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
#define FIO_HAVE_E4_ENG
}
-/*
- * Just check for SPLICE_F_MOVE, if that isn't there, assume the others
- * aren't either.
- */
-#ifndef SPLICE_F_MOVE
-#define SPLICE_F_MOVE (0x01) /* move pages instead of copying */
-#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
- /* we may still block on the fd we splice */
- /* from/to, of course */
-#define SPLICE_F_MORE (0x04) /* expect more data */
-#define SPLICE_F_GIFT (0x08) /* pages passed in are a gift */
-
-static inline int splice(int fdin, loff_t *off_in, int fdout, loff_t *off_out,
- size_t len, unsigned int flags)
-{
- return syscall(__NR_sys_splice, fdin, off_in, fdout, off_out, len, flags);
-}
-
-static inline int tee(int fdin, int fdout, size_t len, unsigned int flags)
-{
- return syscall(__NR_sys_tee, fdin, fdout, len, flags);
-}
-
-static inline int vmsplice(int fd, const struct iovec *iov,
- unsigned long nr_segs, unsigned int flags)
-{
- return syscall(__NR_sys_vmsplice, fd, iov, nr_segs, flags);
-}
-#endif
-
#define SPLICE_DEF_SIZE (64*1024)
#ifndef BLKGETSIZE64
#include "../file.h"
-#define FIO_HAVE_POSIXAIO
#define FIO_HAVE_ODIRECT
-#define FIO_HAVE_STRSEP
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
#define FIO_HAVE_CHARDEV_SIZE
#define FIO_HAVE_GETTID
-#define FIO_HAVE_CLOCK_MONOTONIC
#define OS_MAP_ANON MAP_ANON
#include "../file.h"
-#define FIO_HAVE_POSIXAIO
#define FIO_HAVE_ODIRECT
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
-#define FIO_HAVE_CLOCK_MONOTONIC
#define FIO_HAVE_PSHARED_MUTEX
-#define FIO_HAVE_FADVISE
#define FIO_HAVE_CHARDEV_SIZE
-#define FIO_HAVE_FALLOCATE
-#define FIO_HAVE_POSIXAIO_FSYNC
-#define FIO_HAVE_FDATASYNC
#define OS_MAP_ANON MAP_ANONYMOUS
#define OS_MSG_DONTWAIT 0
#define FIO_OS_HAVE_AIOCB_TYPEDEF
typedef struct aiocb64 os_aiocb_t;
-#define FIO_OS_HAVE_SOCKLEN_T
-typedef int fio_socklen_t;
-
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
return EINVAL;
#include <linux/major.h>
#include <endian.h>
-#include "indirect.h"
#include "binject.h"
#include "../file.h"
-#define FIO_HAVE_LIBAIO
-#define FIO_HAVE_POSIXAIO
-#define FIO_HAVE_FADVISE
#define FIO_HAVE_CPU_AFFINITY
#define FIO_HAVE_DISK_UTIL
#define FIO_HAVE_SGIO
#define FIO_HAVE_IOPRIO
-#define FIO_HAVE_SPLICE
#define FIO_HAVE_IOSCHED_SWITCH
#define FIO_HAVE_ODIRECT
#define FIO_HAVE_HUGETLB
#define FIO_HAVE_RAWBIND
#define FIO_HAVE_BLKTRACE
-#define FIO_HAVE_STRSEP
-#define FIO_HAVE_POSIXAIO_FSYNC
#define FIO_HAVE_PSHARED_MUTEX
#define FIO_HAVE_CL_SIZE
#define FIO_HAVE_CGROUPS
-#define FIO_HAVE_FDATASYNC
#define FIO_HAVE_FS_STAT
#define FIO_HAVE_TRIM
#define FIO_HAVE_BINJECT
-#define FIO_HAVE_CLOCK_MONOTONIC
#define FIO_HAVE_GETTID
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
-#define FIO_HAVE_E4_ENG
#ifdef MAP_HUGETLB
#define FIO_HAVE_MMAP_HUGE
#endif
-/*
- * Can only enable this for newer glibcs, or the header and defines are
- * missing
- */
-#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 6
-#define FIO_HAVE_FALLOCATE
-#endif
-#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 8
-#define FIO_HAVE_LINUX_FALLOCATE
-#endif
-
-#ifdef FIO_HAVE_LINUX_FALLOCATE
-#define FIO_HAVE_FALLOC_ENG
-#endif
-
-#ifdef SYNC_FILE_RANGE_WAIT_BEFORE
-#define FIO_HAVE_SYNC_FILE_RANGE
-#endif
-
#define OS_MAP_ANON MAP_ANONYMOUS
-#ifndef CLOCK_MONOTONIC
-#define CLOCK_MONOTONIC 1
-#endif
-
typedef cpu_set_t os_cpu_mask_t;
typedef struct drand48_data os_random_state_t;
-/*
- * we want fadvise64 really, but it's so tangled... later
- */
-#ifdef FIO_HAVE_FADVISE
-#define fadvise(fd, off, len, advice) \
- posix_fadvise((fd), (off_t)(off), (len), (advice))
-#endif
-
-/*
- * 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
+#ifdef CONFIG_3ARG_AFFINITY
#define fio_setaffinity(pid, cpumask) \
sched_setaffinity((pid), sizeof(cpumask), &(cpumask))
#define fio_getaffinity(pid, ptr) \
sched_getaffinity((pid), sizeof(cpu_set_t), (ptr))
-#else
+#elif defined(CONFIG_2ARG_AFFINITY)
#define fio_setaffinity(pid, cpumask) \
sched_setaffinity((pid), &(cpumask))
#define fio_getaffinity(pid, ptr) \
return syscall(__NR_gettid);
}
-/*
- * Just check for SPLICE_F_MOVE, if that isn't there, assume the others
- * aren't either.
- */
-#ifndef SPLICE_F_MOVE
-#define SPLICE_F_MOVE (0x01) /* move pages instead of copying */
-#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
- /* we may still block on the fd we splice */
- /* from/to, of course */
-#define SPLICE_F_MORE (0x04) /* expect more data */
-#define SPLICE_F_GIFT (0x08) /* pages passed in are a gift */
-
-static inline int splice(int fdin, loff_t *off_in, int fdout, loff_t *off_out,
- size_t len, unsigned int flags)
-{
- return syscall(__NR_sys_splice, fdin, off_in, fdout, off_out, len, flags);
-}
-
-static inline int tee(int fdin, int fdout, size_t len, unsigned int flags)
-{
- return syscall(__NR_sys_tee, fdin, fdout, len, flags);
-}
-
-static inline int vmsplice(int fd, const struct iovec *iov,
- unsigned long nr_segs, unsigned int flags)
-{
- return syscall(__NR_sys_vmsplice, fd, iov, nr_segs, flags);
-}
-#endif
-
#define SPLICE_DEF_SIZE (64*1024)
-#ifdef FIO_HAVE_SYSLET
-
-struct syslet_uatom;
-struct async_head_user;
-
-/*
- * syslet stuff
- */
-static inline struct syslet_uatom *
-async_exec(struct syslet_uatom *atom, struct async_head_user *ahu)
-{
- return (struct syslet_uatom *) syscall(__NR_async_exec, atom, ahu);
-}
-
-static inline long
-async_wait(unsigned long min_wait_events, unsigned long user_ring_idx,
- struct async_head_user *ahu)
-{
- return syscall(__NR_async_wait, min_wait_events,
- user_ring_idx, ahu);
-}
-
-static inline long async_thread(void *event, struct async_head_user *ahu)
-{
- return syscall(__NR_async_thread, event, ahu);
-}
-
-static inline long umem_add(unsigned long *uptr, unsigned long inc)
-{
- return syscall(__NR_umem_add, uptr, inc);
-}
-#endif /* FIO_HAVE_SYSLET */
-
enum {
IOPRIO_CLASS_NONE,
IOPRIO_CLASS_RT,
#define CLOCK_REALTIME 1
#endif
-#define FIO_HAVE_POSIXAIO
-#define FIO_HAVE_CLOCK_MONOTONIC
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
#define FIO_HAVE_GETTID
#include "../file.h"
-#define FIO_HAVE_POSIXAIO
-#define FIO_HAVE_FADVISE
#define FIO_HAVE_ODIRECT
-#define FIO_HAVE_STRSEP
-#define FIO_HAVE_FDATASYNC
#define FIO_USE_GENERIC_BDEV_SIZE
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
#include "../file.h"
-#define FIO_HAVE_POSIXAIO
#define FIO_HAVE_SOLARISAIO
-#define FIO_HAVE_POSIXAIO_FSYNC
#define FIO_HAVE_CPU_AFFINITY
#define FIO_HAVE_PSHARED_MUTEX
-#define FIO_HAVE_FDATASYNC
#define FIO_HAVE_CHARDEV_SIZE
#define FIO_USE_GENERIC_BDEV_SIZE
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
#define FIO_HAVE_GETTID
-#define FIO_HAVE_FADVISE
#define OS_MAP_ANON MAP_ANON
#define OS_RAND_MAX 2147483648UL
#define FIO_HAVE_WINDOWSAIO
#define FIO_HAVE_FALLOCATE
#define FIO_HAVE_GETTID
-#define FIO_HAVE_CLOCK_MONOTONIC
-#define FIO_HAVE_FADVISE
#define FIO_USE_GENERIC_RAND
#define FIO_PREFERRED_ENGINE "windowsaio"
#define FIO_MAX_CPUS MAXIMUM_PROCESSORS
-#define FIO_OS_HAVE_SOCKLEN_T
-typedef int fio_socklen_t;
-
#define OS_MAP_ANON MAP_ANON
#define FIO_LITTLE_ENDIAN
void* (*sa_sigaction)(int, siginfo_t *, void*);
};
-char *strsep(char **stringp, const char *delim);
long sysconf(int name);
int kill(pid_t pid, int sig);
#error "unsupported os"
#endif
-#ifdef FIO_HAVE_LIBAIO
-#include <libaio.h>
-#endif
-
-#ifdef FIO_HAVE_POSIXAIO
+#ifdef CONFIG_POSIXAIO
#include <aio.h>
#ifndef FIO_OS_HAVE_AIOCB_TYPEDEF
typedef struct aiocb os_aiocb_t;
#include <scsi/sg.h>
#endif
-#ifndef FIO_HAVE_STRSEP
+#ifdef CONFIG_STRSEP
#include "../lib/strsep.h"
#endif
#define OS_RAND_MAX RAND_MAX
#endif
-#ifdef FIO_HAVE_CLOCK_MONOTONIC
-#define FIO_TIMER_CLOCK CLOCK_MONOTONIC
-#else
-#define FIO_TIMER_CLOCK CLOCK_REALTIME
-#endif
-
#ifndef FIO_HAVE_RAWBIND
#define fio_lookup_raw(dev, majdev, mindev) 1
#endif
#define FIO_MAX_JOBS 2048
#endif
-#ifndef FIO_OS_HAVE_SOCKLEN_T
-typedef socklen_t fio_socklen_t;
+#ifndef CONFIG_SOCKLEN_T
+typedef unsigned int socklen_t;
#endif
#ifndef FIO_OS_HAS_CTIME_R
+++ /dev/null
-#ifndef _SYSLET_H_
-#define _SYSLET_H_
-
-#include "kcompat.h"
-
-struct syslet_frame {
- u64 ip;
- u64 sp;
-};
-
-struct syslet_args {
- u64 ring_ptr;
- u64 caller_data;
- struct syslet_frame frame;
-};
-
-struct syslet_completion {
- u64 status;
- u64 caller_data;
-};
-
-struct syslet_ring {
- u32 kernel_head;
- u32 user_tail;
- u32 elements;
- u32 wait_group;
- struct syslet_completion comp[0];
-};
-
-#ifdef __x86_64__
-#define __NR_syslet_ring_wait 287
-#elif defined __i386__
-#define __NR_syslet_ring_wait 326
-#endif
-
-#define ESYSLETPENDING 132
-
-typedef void (*syslet_return_func_t)(void);
-
-static inline void fill_syslet_args(struct syslet_args *args,
- struct syslet_ring *ring, uint64_t caller_data,
- syslet_return_func_t func, void *stack)
-{
- args->ring_ptr = (u64)(unsigned long)ring;
- args->caller_data = caller_data;
- args->frame.ip = (u64)(unsigned long)func;
- args->frame.sp = (u64)(unsigned long)stack;
-}
-
-#endif
return ret;
}
-int inet_aton(const char *cp, struct in_addr *inp)
-{
- return inet_pton(AF_INET, cp, inp);
-}
-
int inet_pton(int af, const char *restrict src, void *restrict dst)
{
INT status = SOCKET_ERROR;
fio_net_cmd_crc(&cmd->cmd);
INIT_FLIST_HEAD(&cmd->list);
- gettimeofday(&cmd->tv, NULL);
+ fio_gettime(&cmd->tv, NULL);
cmd->saved_tag = tag;
ret = fio_send_data(sk, &cmd->cmd, sizeof(cmd->cmd));
static int accept_loop(int listen_sk)
{
struct sockaddr_in addr;
- fio_socklen_t len = sizeof(addr);
+ socklen_t len = sizeof(addr);
struct pollfd pfd;
int ret, sk, flags, exitval = 0;
static int fio_init_server_ip(void)
{
struct sockaddr *addr;
- fio_socklen_t socklen;
+ socklen_t socklen;
int sk, opt;
if (use_ipv6)
static int fio_init_server_sock(void)
{
struct sockaddr_un addr;
- fio_socklen_t len;
+ socklen_t len;
mode_t mode;
int sk;