[PATCH] Aggregate bandwidth off-by 1.024
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index bd938979f61caa3f59152d50c4eee03b24b84c53..d9f92b094636d6c652d08e4e907cbefc9b37f61a 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -1282,6 +1282,22 @@ static int init_io_u(struct thread_data *td)
        return 0;
 }
 
+static void cleanup_allocs(struct thread_data *td)
+{
+       if (td->directory)
+               free(td->directory);
+       if (td->iolog_file)
+               free(td->iolog_file);
+       if (td->exec_prerun)
+               free(td->exec_prerun);
+       if (td->exec_postrun)
+               free(td->exec_postrun);
+       if (td->ioscheduler)
+               free(td->ioscheduler);
+       if (td->sysfs_root)
+               free(td->sysfs_root);
+}
+
 static int create_file(struct thread_data *td, unsigned long long size,
                       int extend)
 {
@@ -1990,18 +2006,7 @@ err:
        }
        if (td->mmap)
                munmap(td->mmap, td->file_size);
-       if (td->directory)
-               free(td->directory);
-       if (td->iolog_file)
-               free(td->iolog_file);
-       if (td->exec_prerun)
-               free(td->exec_prerun);
-       if (td->exec_postrun)
-               free(td->exec_postrun);
-       if (td->ioscheduler)
-               free(td->ioscheduler);
-       if (td->sysfs_root)
-               free(td->sysfs_root);
+       cleanup_allocs(td);
        cleanup_io(td);
        cleanup_io_u(td);
        td_set_runstate(td, TD_EXITED);
@@ -2646,9 +2651,9 @@ static void show_run_stats(void)
                rs = &runstats[i];
 
                if (rs->max_run[0])
-                       rs->agg[0] = (rs->io_mb[0]*1024*1000) / rs->max_run[0];
+                       rs->agg[0] = (rs->io_mb[0]*1024*1024) / rs->max_run[0];
                if (rs->max_run[1])
-                       rs->agg[1] = (rs->io_mb[1]*1024*1000) / rs->max_run[1];
+                       rs->agg[1] = (rs->io_mb[1]*1024*1024) / rs->max_run[1];
        }
 
        /*