From e8be2ad711db813537a1f2a6a6939c42909ba5cc Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 29 Mar 2007 10:31:51 +0200 Subject: [PATCH] Only use posix_fallocate(), if we are overwriting Signed-off-by: Jens Axboe --- filesetup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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]); -- 2.25.1