[PATCH] More size fixes

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>
diff --git a/filesetup.c b/filesetup.c
index 3f9bdb8..d6df4f9 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -99,13 +99,9 @@
 	}
 
 	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 @@
 	if (get_file_size(td, f))
 		return 1;
 
-	td->total_file_size += f->file_size;
 	return 0;
 }
 
@@ -377,6 +372,13 @@
 	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);