X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=io_u.c;h=1daaf7bea48407c1e6b21f5143730a7c3d22ff97;hp=b6d530f2a23a542d28673587ababf8a0e091f3e9;hb=755dcbbdec670a0c2e83561070d5fd1462c75dc6;hpb=917c64b368adf1c687b627fd4fe3aa0f214d0cb7 diff --git a/io_u.c b/io_u.c index b6d530f2..1daaf7be 100644 --- a/io_u.c +++ b/io_u.c @@ -531,8 +531,7 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u, int ddir = io_u->ddir; unsigned int buflen = 0; unsigned int minbs, maxbs; - uint64_t frand_max; - unsigned long r; + uint64_t frand_max, r; assert(ddir_rw(ddir)); @@ -561,7 +560,7 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u, if (buflen < minbs) buflen = minbs; } else { - long perc = 0; + long long perc = 0; unsigned int i; for (i = 0; i < td->o.bssplit_nr[ddir]; i++) { @@ -569,16 +568,14 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u, buflen = bsp->bs; perc += bsp->perc; - if ((r * 100UL <= frand_max * perc) && + if (!perc) + break; + if ((r / perc <= frand_max / 100ULL) && io_u_fits(td, io_u, buflen)) break; } } - if (td->o.verify != VERIFY_NONE) - buflen = (buflen + td->o.verify_interval - 1) & - ~(td->o.verify_interval - 1); - if (!td->o.bs_unaligned && is_power_of_2(minbs)) buflen &= ~(minbs - 1); @@ -652,13 +649,17 @@ int io_u_quiesce(struct thread_data *td) completed += ret; } + if (td->flags & TD_F_REGROW_LOGS) + regrow_logs(td); + return completed; } static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir) { enum fio_ddir odir = ddir ^ 1; - long usec, now; + long usec; + uint64_t now; assert(ddir_rw(ddir)); now = utime_since_now(&td->start);