From cbbdf1c8f1aa13c9030808720e04ea1081fd57eb Mon Sep 17 00:00:00 2001 From: Sitsofe Wheeler Date: Thu, 27 Jul 2017 06:06:10 +0100 Subject: [PATCH] fio: refactor fallocate defines Signed-off-by: Sitsofe Wheeler --- filesetup.c | 1 - init.c | 4 ++-- options.c | 6 +++--- os/os.h | 4 ++++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/filesetup.c b/filesetup.c index 3b2ebd9c..362997c1 100644 --- a/filesetup.c +++ b/filesetup.c @@ -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 52560ed3..42e71071 100644 --- 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 diff --git a/options.c b/options.c index b21f09ae..5a2ab57c 100644 --- 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 afee9f9c..2e155291 100644 --- 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 -- 2.25.1