fio: refactor fallocate defines
authorSitsofe Wheeler <sitsofe@yahoo.com>
Thu, 27 Jul 2017 05:06:10 +0000 (06:06 +0100)
committerSitsofe Wheeler <sitsofe@yahoo.com>
Thu, 27 Jul 2017 05:30:16 +0000 (06:30 +0100)
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
filesetup.c
init.c
options.c
os/os.h

index 3b2ebd9..362997c 100644 (file)
@@ -100,7 +100,6 @@ static void fallocate_file(struct thread_data *td, struct fio_file *f)
                log_err("fio: unknown fallocate mode: %d\n", td->o.fallocate_mode);
                assert(0);
        }
-
 }
 
 /*
diff --git a/init.c b/init.c
index 52560ed..42e7107 100644 (file)
--- a/init.c
+++ b/init.c
@@ -781,8 +781,8 @@ 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 */
+#ifndef FIO_HAVE_ANY_FALLOCATE
+       /* Platform doesn't support any fallocate so force it to none */
        o->fallocate_mode = FIO_FALLOCATE_NONE;
 #endif
 
index b21f09a..5a2ab57 100644 (file)
--- a/options.c
+++ b/options.c
@@ -2289,7 +2289,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .parent = "nrfiles",
                .hide   = 1,
        },
-#if defined(CONFIG_POSIX_FALLOCATE) || defined(FIO_HAVE_NATIVE_FALLOCATE)
+#ifdef FIO_HAVE_ANY_FALLOCATE
        {
                .name   = "fallocate",
                .lname  = "Fallocate",
@@ -2333,14 +2333,14 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
 #endif
                },
        },
-#else  /* CONFIG_POSIX_FALLOCATE */
+#else  /* FIO_HAVE_ANY_FALLOCATE */
        {
                .name   = "fallocate",
                .lname  = "Fallocate",
                .type   = FIO_OPT_UNSUPPORTED,
                .help   = "Your platform does not support fallocate",
        },
-#endif /* CONFIG_POSIX_FALLOCATE || FIO_HAVE_NATIVE_FALLOCATE */
+#endif /* FIO_HAVE_ANY_FALLOCATE */
        {
                .name   = "fadvise_hint",
                .lname  = "Fadvise hint",
diff --git a/os/os.h b/os/os.h
index afee9f9..2e15529 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -369,4 +369,8 @@ static inline bool fio_fallocate(struct fio_file *f, uint64_t offset, uint64_t l
 }
 #endif
 
+#if defined(CONFIG_POSIX_FALLOCATE) || defined(FIO_HAVE_NATIVE_FALLOCATE)
+# define FIO_HAVE_ANY_FALLOCATE
+#endif
+
 #endif