[PATCH] Let thread exit cleanup the small allocs
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 8c48a71c0481b69c8a1235d6a53f481c8bb3279c..7aef8225ee6e8b07cab164eb505f0d8e94f590ee 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -360,11 +360,11 @@ static int get_rw_ddir(struct thread_data *td)
                 * Check if it's time to seed a new data direction.
                 */
                if (elapsed >= td->rwmixcycle) {
-                       unsigned long v;
+                       int v;
                        long r;
 
-                       r = os_random_long(&td->random_state);
-                       v = 100UL * r / (unsigned long) (RAND_MAX + 1.0);
+                       r = os_random_long(&td->rwmix_state);
+                       v = 1 + (int) (100.0 * (r / (RAND_MAX + 1.0)));
                        if (v < td->rwmixread)
                                td->rwmix_ddir = DDIR_READ;
                        else
@@ -933,24 +933,6 @@ 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);
-       if (td->file_name)
-               free(td->file_name);
-}
-
 static int create_file(struct thread_data *td, unsigned long long size,
                       int extend)
 {
@@ -1406,7 +1388,6 @@ err:
        }
        if (td->mmap)
                munmap(td->mmap, td->file_size);
-       cleanup_allocs(td);
        cleanup_io(td);
        cleanup_io_u(td);
        td_set_runstate(td, TD_EXITED);