* Patch to fix FreeBSD support
@ 2010-02-10 6:55 Josh Aune
2010-02-10 8:29 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Josh Aune @ 2010-02-10 6:55 UTC (permalink / raw)
To: fio
[-- Attachment #1: Type: text/plain, Size: 133 bytes --]
Hi,
Attached is a patch against fio-1.36 that fixes a few build issues on
FreeBSD. Tested with FreeBSD 8 and Linux Fedora 6.
Josh
[-- Attachment #2: fio-1.36__FreeBSD8.patch --]
[-- Type: application/octet-stream, Size: 1367 bytes --]
Index: fio-1.36/helpers.c
===================================================================
--- fio-1.36.orig/helpers.c 2010-02-09 14:37:13.000000000 -0700
+++ fio-1.36/helpers.c 2010-02-09 14:39:57.000000000 -0700
@@ -1,4 +1,6 @@
-#include <malloc.h>
+#ifndef __FreeBSD__
+ #include <malloc.h>
+#endif
#include <stdlib.h>
#include <errno.h>
#include <sys/socket.h>
@@ -6,6 +8,17 @@
#include "compiler/compiler.h"
+#ifdef __FreeBSD__
+
+// No fdatasync() in FreeBSD
+#include <unistd.h>
+int __weak fdatasync(int fd)
+{
+ return fsync(fd);
+}
+
+#else /* __FreeBSD__ */
+
int __weak posix_memalign(void **ptr, size_t align, size_t size)
{
*ptr = memalign(align, size);
@@ -15,6 +28,8 @@
return ENOMEM;
}
+#endif
+
int __weak posix_fallocate(int fd, off_t offset, off_t len)
{
return 0;
Index: fio-1.36/helpers.h
===================================================================
--- fio-1.36.orig/helpers.h 2010-02-09 14:37:13.000000000 -0700
+++ fio-1.36/helpers.h 2010-02-09 14:38:10.000000000 -0700
@@ -3,7 +3,12 @@
struct in_addr;
+#ifdef __FreeBSD__
+extern int __weak fdatasync(int fd);
+#else // __FreeBSD__
extern int __weak posix_memalign(void **ptr, size_t align, size_t size);
+#endif
+
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);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch to fix FreeBSD support
2010-02-10 6:55 Patch to fix FreeBSD support Josh Aune
@ 2010-02-10 8:29 ` Jens Axboe
2010-02-11 8:16 ` Josh Aune
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2010-02-10 8:29 UTC (permalink / raw)
To: Josh Aune; +Cc: fio
On Tue, Feb 09 2010, Josh Aune wrote:
> Hi,
>
> Attached is a patch against fio-1.36 that fixes a few build issues on
> FreeBSD. Tested with FreeBSD 8 and Linux Fedora 6.
Thanks, but I've moved things along a bit since, can you please check
current -git for me instead? If you don't use git, you can just
download:
http://brick.kernel.dk/snaps/fio-git-latest.tar.gz
and use that instead.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch to fix FreeBSD support
2010-02-10 8:29 ` Jens Axboe
@ 2010-02-11 8:16 ` Josh Aune
2010-02-11 10:19 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Josh Aune @ 2010-02-11 8:16 UTC (permalink / raw)
To: Jens Axboe; +Cc: fio
[-- Attachment #1: Type: text/plain, Size: 274 bytes --]
On Wed, Feb 10, 2010 at 1:29 AM, Jens Axboe <jens.axboe@oracle.com> wrote:
>
> Thanks, but I've moved things along a bit since, can you please check
> current -git for me instead? If you don't use git,
Not very well, but see the attached for some additional changes.
Josh
[-- Attachment #2: 0001-Fix-dep-calculation-in-Makefile.FreeBSD-to-ignore-ot.patch --]
[-- Type: application/octet-stream, Size: 2618 bytes --]
From e16acdfe2ba2ede6e05525d93b8bd264b6ca44a4 Mon Sep 17 00:00:00 2001
From: Joshua Aune <luken@fusionio.com>
Date: Thu, 11 Feb 2010 00:59:18 -0700
Subject: [PATCH] * 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()
---
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 91a1ec3..dbaee76 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 947bb85..b499893 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 b5ced88..af83757 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 062c44c..8d965aa 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
--
1.6.4.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Patch to fix FreeBSD support
2010-02-11 8:16 ` Josh Aune
@ 2010-02-11 10:19 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2010-02-11 10:19 UTC (permalink / raw)
To: Josh Aune; +Cc: fio
On Thu, Feb 11 2010, Josh Aune wrote:
> On Wed, Feb 10, 2010 at 1:29 AM, Jens Axboe <jens.axboe@oracle.com> wrote:
> >
> > Thanks, but I've moved things along a bit since, can you please check
> > current -git for me instead? If you don't use git,
>
> Not very well, but see the attached for some additional changes.
Thanks, I've applied it. I plan on doing a 1.37 version fairly soon,
preferably before going on vacation next week.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-02-11 10:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-10 6:55 Patch to fix FreeBSD support Josh Aune
2010-02-10 8:29 ` Jens Axboe
2010-02-11 8:16 ` Josh Aune
2010-02-11 10:19 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox