io_u: speed up __get_next_buflen()
authorAndrey Kuzmin <andrey.v.kuzmin@gmail.com>
Mon, 7 Mar 2016 21:40:25 +0000 (14:40 -0700)
committerJens Axboe <axboe@fb.com>
Mon, 7 Mar 2016 21:40:25 +0000 (14:40 -0700)
Change the divide-by-100 into a multiplier instead.

Signed-off-by: Jens Axboe <axboe@fb.com>
io_u.c

diff --git a/io_u.c b/io_u.c
index 0a3988699987c282f6004b832e4096bc2de49f88..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;
                        }