From: Jens Axboe Date: Mon, 2 Jun 2008 10:23:40 +0000 (+0200) Subject: Guard posix_fallocate() behind OS define X-Git-Tag: fio-1.21-rc5~6 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=fffca02dfd1b700903ba23b67fab7b59bf460ec2 Guard posix_fallocate() behind OS define Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index 746b3cda..0b297641 100644 --- a/filesetup.c +++ b/filesetup.c @@ -68,11 +68,13 @@ static int extend_file(struct thread_data *td, struct fio_file *f) goto err; } +#ifdef FIO_HAVE_FALLOCATE dprint(FD_FILE, "fallocate file %s, size %llu\n", f->file_name, f->real_file_size); r = posix_fallocate(f->fd, 0, f->real_file_size); if (r < 0) log_err("fio: posix_fallocate fails: %s\n", strerror(-r)); +#endif b = malloc(td->o.max_bs[DDIR_WRITE]); memset(b, 0, td->o.max_bs[DDIR_WRITE]); diff --git a/os/os-linux.h b/os/os-linux.h index 6f2372bc..4c145a60 100644 --- a/os/os-linux.h +++ b/os/os-linux.h @@ -26,6 +26,7 @@ #define FIO_HAVE_RAWBIND #define FIO_HAVE_BLKTRACE #define FIO_HAVE_STRSEP +#define FIO_HAVE_FALLOCATE #define OS_MAP_ANON (MAP_ANONYMOUS) diff --git a/os/os-solaris.h b/os/os-solaris.h index 7fa0bb50..ae905169 100644 --- a/os/os-solaris.h +++ b/os/os-solaris.h @@ -9,6 +9,7 @@ #undef FIO_HAVE_DISK_UTIL #undef FIO_HAVE_SGIO #undef FIO_HAVE_ODIRECT +#define FIO_HAVE_FALLOCATE #define OS_MAP_ANON (MAP_ANON)