init: force fallocate_mode to none when fallocate is unsupported
authorSitsofe Wheeler <sitsofe@yahoo.com>
Thu, 27 Jul 2017 04:50:41 +0000 (05:50 +0100)
committerSitsofe Wheeler <sitsofe@yahoo.com>
Thu, 27 Jul 2017 05:30:16 +0000 (06:30 +0100)
Commit 2c3e17be ("filesetup: add native fallocate") broke fio on Windows
because fallocate_mode wound up being set to 0 on platforms without any
type of fallocate. Work around this by forcing fallocate_mode to
FIO_FALLOCATE_NONE on such platforms.

This should address the issue mention in the mail
http://www.spinics.net/lists/fio/msg06085.html ("The commit 'filesetup:
add native fallocate' breaks on Cygwin").

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
init.c

diff --git a/init.c b/init.c
index 90cc0bcf770e21361b94ec6d15b29749aff0f3bb..52560ed34ab59a28ad6a1825068f58e75496bea0 100644 (file)
--- a/init.c
+++ b/init.c
@@ -781,6 +781,11 @@ static int fixup_options(struct thread_data *td)
                        o->unit_base = 8;
        }
 
+#if !defined(CONFIG_POSIX_FALLOCATE) && !defined(FIO_HAVE_NATIVE_FALLOCATE)
+       /* Platform doesn't support fallocate so force set it to none */
+       o->fallocate_mode = FIO_FALLOCATE_NONE;
+#endif
+
 #ifndef CONFIG_FDATASYNC
        if (o->fdatasync_blocks) {
                log_info("fio: this platform does not support fdatasync()"