Fix FreeBSD support
authorJoshua Aune <luken@fusionio.com>
Thu, 11 Feb 2010 07:59:18 +0000 (00:59 -0700)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 11 Feb 2010 10:18:53 +0000 (11:18 +0100)
* Fix dep calculation in Makefile.FreeBSD to ignore other os specific
   header files, avoid blowing up on includes in os-solaris.h
 * Mark FreeBSD as not supporting fdatasync()
 * Add documentation note about FreeBSD not supporting fsyncdata=
 * Add warning if fsyncdata= is used on os that doesn't support, fall
   back to fsync()

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
HOWTO
Makefile.FreeBSD
init.c
os/os-freebsd.h

diff --git a/HOWTO b/HOWTO
index 91a1ec353cf3180168ea7352b8a506c94b04ed99..886515b7aa754527070ee24ab785d66abb5b0b3e 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -568,6 +568,8 @@ fsync=int   If writing to a file, issue a sync of the dirty data
 
 fsyncdata=int  Like fsync= but uses fdatasync() to only sync data and not
                metadata blocks.
+               In FreeBSD there is no fdatasync(), this falls back to
+               using fsync()
 
 overwrite=bool If true, writes to a file will always overwrite existing
                data. If the file doesn't already exist, it will be
index 947bb859e97334772d6b56c9b34d34e092a75e25..b4998933fe2701b362bb6bdb50185a3e36bdd310 100644 (file)
@@ -30,7 +30,8 @@ SOURCE = eta.c filehash.c filesetup.c fio.c gettime.c init.c ioengines.c \
         io_u.c log.c memory.c mutex.c options.c parse.c rbtree.c smalloc.c \
         stat.c parse.c crc/*.c engines/cpu.c engines/mmap.c \
         engines/posixaio.c engines/sync.c engines/null.c engines/net.c \
-        *.h */*.h
+        *.h arch/*.h compiler/*.h crc/*.h lib/*.h \
+        os/indirect.h os/kcompat.h os/os-freebsd.h os/os.h os/syslet.h
 
 ifneq ($(findstring $(MAKEFLAGS),s),s)
 ifndef V
diff --git a/init.c b/init.c
index b5ced8898311d7684103b47dcf552d62ee8c59ef..af8375759343d80dbb2e728da51a44cbf2c22bc5 100644 (file)
--- a/init.c
+++ b/init.c
@@ -382,6 +382,17 @@ static int fixup_options(struct thread_data *td)
                                 " that isn't seekable. Pre-read disabled.\n");
        }
 
+#ifndef FIO_HAVE_FDATASYNC
+       if (td->o.fdatasync_blocks) {
+               log_info("fio: this platform does not support fdatasync()"
+                        " falling back to using fsync().  Use the 'fsync'"
+                        " option instead of 'fdatasync' to get rid of"
+                        " this warning\n");
+               td->o.fsync_blocks = td->o.fdatasync_blocks;
+               td->o.fdatasync_blocks = 0;
+       }
+#endif
+
        return 0;
 }
 
index 062c44cdc3363c5ee6436257a78530f1e08bb221..8d965aadf87ec84372f83bd07029f2e414c35992 100644 (file)
@@ -8,7 +8,6 @@
 #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