Don't truncate files if we don't need to extend them

From: Shawn Lewis <shawnlewis_at_google.com>
Date: Thu, 10 Jan 2008 19:56:56 -0800 (PST)

Don't truncate files if we don't need to extend them.

diff --git a/filesetup.c b/filesetup.c
index b4c1a6e..134ee1a 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -54,14 +54,14 @@ static int extend_file(struct thread_dat
                 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;
Received on Fri Jan 11 2008 - 04:56:56 CET

This archive was generated by hypermail 2.2.0 : Fri Jan 11 2008 - 05:00:01 CET