Only use posix_fallocate(), if we are overwriting
authorJens Axboe <jens.axboe@oracle.com>
Thu, 29 Mar 2007 08:31:51 +0000 (10:31 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 29 Mar 2007 08:31:51 +0000 (10:31 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
filesetup.c

index 161f63e7d1a5aee2597e146513396406784fd4c2..e9dc72db740669952d4c8d4fb24dea38855fdfeb 100644 (file)
@@ -47,14 +47,14 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
                goto err;
        }
 
                goto err;
        }
 
+       if (!new_layout)
+               goto done;
+
        if (posix_fallocate(f->fd, 0, f->real_file_size) < 0) {
                td_verror(td, errno, "posix_fallocate");
                goto err;
        }
 
        if (posix_fallocate(f->fd, 0, f->real_file_size) < 0) {
                td_verror(td, errno, "posix_fallocate");
                goto err;
        }
 
-       if (!new_layout)
-               goto done;
-
        b = malloc(td->o.max_bs[DDIR_WRITE]);
        memset(b, 0, td->o.max_bs[DDIR_WRITE]);
 
        b = malloc(td->o.max_bs[DDIR_WRITE]);
        memset(b, 0, td->o.max_bs[DDIR_WRITE]);