Add locking around reads of td->io_blocks and io_byes.
[fio.git] / steadystate.c
index 1e7212f83ab5d40a0673b821dd04e2e423eba79f..e0dcc22e465c68f80bfeef71704415c0077cdfae 100644 (file)
@@ -69,10 +69,12 @@ void steadystate_check()
                        if (utime_since(&td->epoch, &now) >= (ss->ramp_time + 1000000L))
                                ss->ramp_time_over = 1;
 
+               td_io_u_lock(td);
                for (ddir = DDIR_READ; ddir < DDIR_RWDIR_CNT; ddir++) {
                        td_iops += td->io_blocks[ddir];
                        td_bytes += td->io_bytes[ddir];
                }
+               td_io_u_unlock(td);
 
                rate_time = mtime_since(&ss->prev_time, &now);
                memcpy(&ss->prev_time, &now, sizeof(now));