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 3b2ebd9c1ec70a3b3361bf15dabe7d56b19c979c..362997c15856dbb83b2ab39a0a123e217dd65dd7 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 52560ed34ab59a28ad6a1825068f58e75496bea0..42e710715a250e2eca8f2a6a8cd7c609e6571455 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 b21f09ae169a2287c70adadc6e931f9bd52042c1..5a2ab57c4e5294c3ac5cc52d38b4e2d6d4188aaf 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 afee9f9c65456fb5e50ac5139eb6fc398d6a24f3..2e1552914cd2fa9593230e14e6e68edeeafcc02c 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