From e72fa4d40565e7a213698d8696b81f80e4670982 Mon Sep 17 00:00:00 2001 From: Joshua Aune Date: Thu, 11 Feb 2010 00:59:18 -0700 Subject: [PATCH] Fix FreeBSD support * 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 --- HOWTO | 2 ++ Makefile.FreeBSD | 3 ++- init.c | 11 +++++++++++ os/os-freebsd.h | 1 - 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/HOWTO b/HOWTO index 91a1ec35..886515b7 100644 --- 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 diff --git a/Makefile.FreeBSD b/Makefile.FreeBSD index 947bb859..b4998933 100644 --- a/Makefile.FreeBSD +++ b/Makefile.FreeBSD @@ -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 b5ced889..af837575 100644 --- 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; } diff --git a/os/os-freebsd.h b/os/os-freebsd.h index 062c44cd..8d965aad 100644 --- a/os/os-freebsd.h +++ b/os/os-freebsd.h @@ -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 -- 2.25.1