lib/rand: make __init_randX() static
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 599bf08d8a4594aa7f12b46c80ca585d67f3834a..ea08c927f72e1b9d96e2ae05d5a1eb8fba122b9c 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -177,7 +177,7 @@ bail:
        /*
         * Generate a value, v, between 1 and 100, both inclusive
         */
-       v = rand_between(&td->zone_state, 1, 100);
+       v = rand32_between(&td->zone_state, 1, 100);
 
        zsi = &td->zone_state_index[ddir][v - 1];
        stotal = zsi->size_perc_prev;
@@ -279,7 +279,7 @@ static bool should_do_random(struct thread_data *td, enum fio_ddir ddir)
        if (td->o.perc_rand[ddir] == 100)
                return true;
 
-       v = rand_between(&td->seq_rand_state[ddir], 1, 100);
+       v = rand32_between(&td->seq_rand_state[ddir], 1, 100);
 
        return v <= td->o.perc_rand[ddir];
 }
@@ -553,7 +553,7 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
 
                                buflen = bsp->bs;
                                perc += bsp->perc;
-                               if ((r <= ((frand_max / 100L) * perc)) &&
+                               if ((r * 100UL <= frand_max * perc) &&
                                    io_u_fits(td, io_u, buflen))
                                        break;
                        }
@@ -601,7 +601,7 @@ static inline enum fio_ddir get_rand_ddir(struct thread_data *td)
 {
        unsigned int v;
 
-       v = rand_between(&td->rwmix_state, 1, 100);
+       v = rand32_between(&td->rwmix_state, 1, 100);
 
        if (v <= td->o.rwmix[DDIR_READ])
                return DDIR_READ;
@@ -1667,7 +1667,7 @@ void io_u_log_error(struct thread_data *td, struct io_u *io_u)
 {
        __io_u_log_error(td, io_u);
        if (td->parent)
-               __io_u_log_error(td, io_u);
+               __io_u_log_error(td->parent, io_u);
 }
 
 static inline bool gtod_reduce(struct thread_data *td)
@@ -1964,7 +1964,7 @@ static struct frand_state *get_buf_state(struct thread_data *td)
                return &td->buf_state;
        }
 
-       v = rand_between(&td->dedupe_state, 1, 100);
+       v = rand32_between(&td->dedupe_state, 1, 100);
 
        if (v <= td->o.dedupe_percentage)
                return &td->buf_state_prev;