Add locking around reads of td->io_blocks and io_byes.
authorVincent Fu <Vincent.Fu@sandisk.com>
Thu, 23 Jun 2016 15:32:04 +0000 (11:32 -0400)
committerJens Axboe <axboe@fb.com>
Mon, 15 Aug 2016 15:44:52 +0000 (09:44 -0600)
This is present in add_bw/iops/lat_sample but absent from show_thread_status. Not certain if this is really necessary.

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;
 
                        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];
                }
                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));
 
                rate_time = mtime_since(&ss->prev_time, &now);
                memcpy(&ss->prev_time, &now, sizeof(now));