From fc74ac1d749c977308016eb22c8658a9a5ac7989 Mon Sep 17 00:00:00 2001 From: Shawn Lewis Date: Fri, 11 Jan 2008 09:45:11 +0100 Subject: [PATCH 1/1] Don't truncate files if we don't need to extend them Don't truncate files if we don't need to extend them. Signed-off-by: Jens Axboe --- filesetup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/filesetup.c b/filesetup.c index 210cd2ff..34130b89 100644 --- a/filesetup.c +++ b/filesetup.c @@ -50,14 +50,14 @@ static int extend_file(struct thread_data *td, struct fio_file *f) return 1; } + if (!new_layout) + goto done; + if (ftruncate(f->fd, f->real_file_size) == -1) { td_verror(td, errno, "ftruncate"); 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; -- 2.25.1