summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-12-20 22:29:10 +0100
committerJens Axboe <jens.axboe@oracle.com>2009-12-20 22:29:10 +0100
commitc36d16f5a0b9e3d505c9933bbbdccdb519ca4faf (patch)
tree2f1fb4e3c352ebc87e8b137c6d2bb0fcf599d30f
parenta14ca44ada0708be91ed7741a32176bef4801cc4 (diff)
downloadfio-c36d16f5a0b9e3d505c9933bbbdccdb519ca4faf.tar.gz
fio-c36d16f5a0b9e3d505c9933bbbdccdb519ca4faf.tar.bz2
Make fdatasync OS optional
OSX does not have it. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--engines/sync.c10
-rw-r--r--os/os-freebsd.h1
-rw-r--r--os/os-linux.h1
-rw-r--r--os/os-solaris.h1
4 files changed, 11 insertions, 2 deletions
diff --git a/engines/sync.c b/engines/sync.c
index 7c1cca63..c375e9a8 100644
--- a/engines/sync.c
+++ b/engines/sync.c
@@ -162,9 +162,15 @@ static int fio_vsyncio_queue(struct thread_data *td, struct io_u *io_u)
return fio_io_end(td, io_u, ret);
} else if (io_u->ddir == DDIR_DATASYNC) {
- int ret = fdatasync(io_u->file->fd);
-
+ int ret;
+#ifdef FIO_HAVE_FDATASYNC
+ ret = fdatasync(io_u->file->fd);
+#else
+ ret = io_u->xfer_buflen;
+ io_u->error = EINVAL;
+#endif
return fio_io_end(td, io_u, ret);
+
}
sd->queued = 0;
diff --git a/os/os-freebsd.h b/os/os-freebsd.h
index 8d965aad..062c44cd 100644
--- a/os/os-freebsd.h
+++ b/os/os-freebsd.h
@@ -8,6 +8,7 @@
#define FIO_HAVE_ODIRECT
#define FIO_USE_GENERIC_BDEV_SIZE
#define FIO_USE_GENERIC_RAND
+#define FIO_HAVE_FDATASYNC
#define OS_MAP_ANON MAP_ANON
diff --git a/os/os-linux.h b/os/os-linux.h
index 7162dfa2..01140e0d 100644
--- a/os/os-linux.h
+++ b/os/os-linux.h
@@ -33,6 +33,7 @@
#define FIO_HAVE_PSHARED_MUTEX
#define FIO_HAVE_CL_SIZE
#define FIO_HAVE_CGROUPS
+#define FIO_HAVE_FDATASYNC
#define OS_MAP_ANON MAP_ANONYMOUS
diff --git a/os/os-solaris.h b/os/os-solaris.h
index c6419d83..f8ce1f31 100644
--- a/os/os-solaris.h
+++ b/os/os-solaris.h
@@ -14,6 +14,7 @@
#define FIO_HAVE_CPU_AFFINITY
#define FIO_HAVE_PSHARED_MUTEX
#define FIO_USE_GENERIC_BDEV_SIZE
+#define FIO_HAVE_FDATASYNC
#define OS_MAP_ANON MAP_ANON
#define OS_RAND_MAX 2147483648UL