Guard posix_fallocate() behind OS define
authorJens Axboe <jens.axboe@oracle.com>
Mon, 2 Jun 2008 10:23:40 +0000 (12:23 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 2 Jun 2008 10:23:40 +0000 (12:23 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
filesetup.c
os/os-linux.h
os/os-solaris.h

index 746b3cda4da05b4717ad0a551c40f907e5323368..0b297641b11da6277b2b2c753c8d8cd6ccf11468 100644 (file)
@@ -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]);
index 6f2372bcd7e48bc7074928a4afa0212202ebade3..4c145a60e0ced61d13e6c04a5f8083f1947b8383 100644 (file)
@@ -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)
 
index 7fa0bb50e1b06f1b3642cbb5cab4a060bab71015..ae905169cc720a33b90c4f2a47abfd8a045f59dc 100644 (file)
@@ -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)