[PATCH] rwmix seed got broken with random abstraction, fixup
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index ccf0ad8a4dc24c28262014aabdfb42a174b680b8..aa5071ca527e7d77817b6ffefb2270171f9254e8 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
@@ -947,6 +947,8 @@ static void cleanup_allocs(struct thread_data *td)
                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,