From: Shawn Lewis Date: Fri, 11 Jan 2008 08:45:11 +0000 (+0100) Subject: Don't truncate files if we don't need to extend them X-Git-Tag: fio-1.17.3~11 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=fc74ac1d749c977308016eb22c8658a9a5ac7989;hp=aa31f1f108348ba2a8749c73fa8c25f3d4630a7c 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 --- 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;