From: Jens Axboe Date: Fri, 3 Mar 2023 17:46:26 +0000 (-0700) Subject: Merge branch 'For_Each_Td_Private_Scope' of https://github.com/horshack-dpreview/fio X-Git-Tag: fio-3.34~3 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=051b5785bc47ab216fa3db9dceb6184073dcc88a;p=fio.git Merge branch 'For_Each_Td_Private_Scope' of https://github.com/horshack-dpreview/fio * 'For_Each_Td_Private_Scope' of https://github.com/horshack-dpreview/fio: Refactor for_each_td() to catch inappropriate td ptr reuse Signed-off-by: Jens Axboe --- 051b5785bc47ab216fa3db9dceb6184073dcc88a diff --cc eta.c index f315e806,b392b83c..ce1c6f2d --- a/eta.c +++ b/eta.c @@@ -381,9 -381,7 +381,8 @@@ bool eta_time_within_slack(unsigned in */ bool calc_thread_status(struct jobs_eta *je, int force) { - struct thread_data *td; - int i, unified_rw_rep; + int unified_rw_rep; + bool any_td_in_ramp; uint64_t rate_time, disp_time, bw_avg_time, *eta_secs; unsigned long long io_bytes[DDIR_RWDIR_CNT] = {}; unsigned long long io_iops[DDIR_RWDIR_CNT] = {}; @@@ -506,11 -504,7 +505,11 @@@ fio_gettime(&now, NULL); rate_time = mtime_since(&rate_prev_time, &now); - if (write_bw_log && rate_time > bw_avg_time /* && !in_ramp_time(td) fixme: td isn't valid here */) { + any_td_in_ramp = false; - for_each_td(td, i) { ++ for_each_td(td) { + any_td_in_ramp |= in_ramp_time(td); - } ++ } end_for_each(); + if (write_bw_log && rate_time > bw_avg_time && !any_td_in_ramp) { calc_rate(unified_rw_rep, rate_time, io_bytes, rate_io_bytes, je->rate); memcpy(&rate_prev_time, &now, sizeof(now));