Merge branch 'For_Each_Td_Private_Scope' of https://github.com/horshack-dpreview/fio
authorJens Axboe <axboe@kernel.dk>
Fri, 3 Mar 2023 17:46:26 +0000 (10:46 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 3 Mar 2023 17:46:26 +0000 (10:46 -0700)
* '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 <axboe@kernel.dk>
1  2 
eta.c

diff --cc eta.c
index f315e80654d5ee5771297de7808788576e52c2f1,b392b83c2a44b4904b103b740eb51ace22fe9392..ce1c6f2dcd86431fc7561fdac4d684e2d9b0751b
--- 1/eta.c
--- 2/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] = {};
        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));