From 1ec4db15283551fc135b40dbd8abc07d4f67743e Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Mon, 7 Mar 2016 14:40:25 -0700 Subject: [PATCH 1/1] io_u: speed up __get_next_buflen() Change the divide-by-100 into a multiplier instead. Signed-off-by: Jens Axboe --- io_u.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_u.c b/io_u.c index 0a398869..3299f290 100644 --- 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; } -- 2.25.1