Fix latency logging for io_submit_mode=offload
authorJens Axboe <axboe@fb.com>
Sat, 20 Jun 2015 17:21:48 +0000 (13:21 -0400)
committerJens Axboe <axboe@fb.com>
Sat, 20 Jun 2015 17:21:48 +0000 (13:21 -0400)
Signed-off-by: Jens Axboe <axboe@fb.com>
io_u.c
stat.c

diff --git a/io_u.c b/io_u.c
index 63a176f5eb02b315f3646bfca3fd299279e4f5e4..d80ef983c15972e4dbafc00fb68319826f16b3f2 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1604,6 +1604,9 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u,
        const int no_reduce = !gtod_reduce(td);
        unsigned long lusec = 0;
 
+       if (td->parent)
+               td = td->parent;
+
        if (no_reduce)
                lusec = utime_since(&io_u->issue_time, &icd->time);
 
@@ -1633,9 +1636,6 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u,
                io_u_mark_latency(td, lusec);
        }
 
-       if (td->parent)
-               td = td->parent;
-
        if (!td->o.disable_bw)
                add_bw_sample(td, idx, bytes, &icd->time);
 
@@ -1891,6 +1891,10 @@ void io_u_queued(struct thread_data *td, struct io_u *io_u)
                unsigned long slat_time;
 
                slat_time = utime_since(&io_u->start_time, &io_u->issue_time);
+
+               if (td->parent)
+                       td = td->parent;
+
                add_slat_sample(td, io_u->ddir, slat_time, io_u->xfer_buflen,
                                io_u->offset);
        }
diff --git a/stat.c b/stat.c
index 7d6ee63dc2dd3dac9faddaeb96da5e34d0a72713..30a2c1e749530c987e3efd0649d519b789ab6681 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1962,6 +1962,8 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
        if (!ddir_rw(ddir))
                return;
 
+       td_io_u_lock(td);
+
        add_stat_sample(&ts->clat_stat[ddir], usec);
 
        if (td->clat_log)
@@ -1969,6 +1971,8 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
 
        if (ts->clat_percentiles)
                add_clat_percentile_sample(ts, usec, ddir);
+
+       td_io_u_unlock(td);
 }
 
 void add_slat_sample(struct thread_data *td, enum fio_ddir ddir,
@@ -1979,10 +1983,14 @@ void add_slat_sample(struct thread_data *td, enum fio_ddir ddir,
        if (!ddir_rw(ddir))
                return;
 
+       td_io_u_lock(td);
+
        add_stat_sample(&ts->slat_stat[ddir], usec);
 
        if (td->slat_log)
                add_log_sample(td, td->slat_log, usec, ddir, bs, offset);
+
+       td_io_u_unlock(td);
 }
 
 void add_lat_sample(struct thread_data *td, enum fio_ddir ddir,
@@ -1993,10 +2001,14 @@ void add_lat_sample(struct thread_data *td, enum fio_ddir ddir,
        if (!ddir_rw(ddir))
                return;
 
+       td_io_u_lock(td);
+
        add_stat_sample(&ts->lat_stat[ddir], usec);
 
        if (td->lat_log)
                add_log_sample(td, td->lat_log, usec, ddir, bs, offset);
+
+       td_io_u_unlock(td);
 }
 
 void add_bw_sample(struct thread_data *td, enum fio_ddir ddir, unsigned int bs,