From: Jens Axboe Date: Fri, 31 Mar 2023 18:52:01 +0000 (-0600) Subject: Only expose fadvise_hint=noreuse if supported X-Git-Tag: fio-3.35~43 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=638689b15af35bd746f9114a3e8895e7a983ed83;p=fio.git Only expose fadvise_hint=noreuse if supported At least OSX doesn't have this option or define, just make it available if it's there on the platform we're building on. Fixes: eb314e7072a0 ("fio: add support for POSIX_FADV_NOREUSE") Signed-off-by: Jens Axboe --- diff --git a/ioengines.c b/ioengines.c index 56759c53..742f97dd 100644 --- a/ioengines.c +++ b/ioengines.c @@ -565,8 +565,10 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f) flags = POSIX_FADV_RANDOM; else if (td->o.fadvise_hint == F_ADV_SEQUENTIAL) flags = POSIX_FADV_SEQUENTIAL; +#ifdef POSIX_FADV_NOREUSE else if (td->o.fadvise_hint == F_ADV_NOREUSE) flags = POSIX_FADV_NOREUSE; +#endif else { log_err("fio: unknown fadvise type %d\n", td->o.fadvise_hint); diff --git a/options.c b/options.c index fe580ebb..440bff37 100644 --- a/options.c +++ b/options.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -2740,10 +2741,12 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .oval = F_ADV_SEQUENTIAL, .help = "Advise using FADV_SEQUENTIAL", }, +#ifdef POSIX_FADV_NOREUSE { .ival = "noreuse", .oval = F_ADV_NOREUSE, .help = "Advise using FADV_NOREUSE", }, +#endif }, .help = "Use fadvise() to advise the kernel on IO pattern", .def = "1",