[PATCH] More size fixes
authorJens Axboe <jens.axboe@oracle.com>
Fri, 20 Oct 2006 08:36:42 +0000 (10:36 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 20 Oct 2006 08:36:42 +0000 (10:36 +0200)
Clean it up so that the create/non-create/bdev paths are the same
to avoid further problems in this area.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
filesetup.c

index 3f9bdb8333f989057529652eee34f5a6a0378116..d6df4f9fccb7b699c7e5dcfe292bbd4b6d65d8ac 100644 (file)
@@ -99,13 +99,9 @@ static int create_files(struct thread_data *td)
        }
 
        need_create = 0;
-       for_each_file(td, f, i) {
-               if (td->filetype == FIO_TYPE_FILE) {
-                       f->file_size = td->total_file_size / td->nr_files;
+       if (td->filetype == FIO_TYPE_FILE)
+               for_each_file(td, f, i)
                        need_create += file_ok(td, f);
-               } else
-                       td->total_file_size += f->file_size;
-       }
 
        if (!need_create)
                return 0;
@@ -348,7 +344,6 @@ static int setup_file(struct thread_data *td, struct fio_file *f)
        if (get_file_size(td, f))
                return 1;
 
-       td->total_file_size += f->file_size;
        return 0;
 }
 
@@ -377,6 +372,13 @@ int setup_files(struct thread_data *td)
        if (err)
                return err;
 
+       /*
+        * Recalculate the total file size now that files are set up.
+        */
+       td->total_file_size = 0;
+       for_each_file(td, f, i)
+               td->total_file_size += f->file_size;
+
        td->io_size = td->total_file_size;
        if (td->io_size == 0) {
                log_err("%s: no io blocks\n", td->name);