From: Jens Axboe Date: Thu, 29 Mar 2007 08:31:51 +0000 (+0200) Subject: Only use posix_fallocate(), if we are overwriting X-Git-Tag: fio-1.15.1~13 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=e8be2ad711db813537a1f2a6a6939c42909ba5cc;p=fio.git Only use posix_fallocate(), if we are overwriting Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index 161f63e7..e9dc72db 100644 --- a/filesetup.c +++ b/filesetup.c @@ -47,14 +47,14 @@ static int extend_file(struct thread_data *td, struct fio_file *f) 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 (!new_layout) - goto done; - b = malloc(td->o.max_bs[DDIR_WRITE]); memset(b, 0, td->o.max_bs[DDIR_WRITE]);