io_u: speed up __get_next_buflen()
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 599bf08d8a4594aa7f12b46c80ca585d67f3834a..3299f2907af47bb3e6d7b59d2c35aad004509df2 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -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;
                        }
@@ -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)