Track fsync/fdatasync/sync_file_range issue count
authorJens Axboe <axboe@kernel.dk>
Thu, 25 Jan 2018 16:27:14 +0000 (09:27 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 25 Jan 2018 16:27:14 +0000 (09:27 -0700)
Also fix an issue where we didn't initialize the sync minimum
latency correctly, so it was always reported as 0.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
init.c
io_ddir.h
ioengines.c
stat.c
stat.h

diff --git a/init.c b/init.c
index 8a80138394cfdf81689f23f3f057c653874b3b86..ae3c4f74c9dbf86bd61e4c1da3565a9a1544cbad 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1481,6 +1481,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
                td->ts.bw_stat[i].min_val = ULONG_MAX;
                td->ts.iops_stat[i].min_val = ULONG_MAX;
        }
+       td->ts.sync_stat.min_val = ULONG_MAX;
        td->ddir_seq_nr = o->ddir_seq_nr;
 
        if ((o->stonewall || o->new_group) && prev_group_jobs) {
index 613d5fbce2625ab5b9b41d74fcab5ffebdd2694a..71084aa4065b71a61b8860711b7968367cfb2cb9 100644 (file)
--- a/io_ddir.h
+++ b/io_ddir.h
@@ -5,8 +5,11 @@ enum fio_ddir {
        DDIR_READ = 0,
        DDIR_WRITE = 1,
        DDIR_TRIM = 2,
-       DDIR_RWDIR_CNT = 3,
        DDIR_SYNC = 3,
+
+       DDIR_RWDIR_CNT = 3,
+       DDIR_RWDIR_SYNC_CNT = 4,
+
        DDIR_DATASYNC,
        DDIR_SYNC_FILE_RANGE,
        DDIR_WAIT,
index fb475e9711d6b7fe9ccd6ba4496c9f7b7d64e85e..5dd2311af03db24c344ea35887a7f2f3a3f4885a 100644 (file)
@@ -357,7 +357,7 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
        }
 
        if (ret == FIO_Q_COMPLETED) {
-               if (ddir_rw(io_u->ddir)) {
+               if (ddir_rw(io_u->ddir) || ddir_sync(io_u->ddir)) {
                        io_u_mark_depth(td, 1);
                        td->ts.total_io_u[io_u->ddir]++;
                }
@@ -366,7 +366,7 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
 
                td->io_u_queued++;
 
-               if (ddir_rw(io_u->ddir))
+               if (ddir_rw(io_u->ddir) || ddir_sync(io_u->ddir))
                        td->ts.total_io_u[io_u->ddir]++;
 
                if (td->io_u_queued >= td->o.iodepth_batch) {
diff --git a/stat.c b/stat.c
index 3a014d6c1aa8f8e7f10690bf09caba68396e52d8..36e06457ccafa31344f38d85cfc615fc2c1374a1 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -854,12 +854,13 @@ static void show_thread_status_normal(struct thread_stat *ts,
                                        io_u_dist[1], io_u_dist[2],
                                        io_u_dist[3], io_u_dist[4],
                                        io_u_dist[5], io_u_dist[6]);
-       log_buf(out, "     issued rwt: total=%llu,%llu,%llu,"
-                                " short=%llu,%llu,%llu,"
-                                " dropped=%llu,%llu,%llu\n",
+       log_buf(out, "     issued rwts: total=%llu,%llu,%llu,%llu"
+                                " short=%llu,%llu,%llu,0"
+                                " dropped=%llu,%llu,%llu,0\n",
                                        (unsigned long long) ts->total_io_u[0],
                                        (unsigned long long) ts->total_io_u[1],
                                        (unsigned long long) ts->total_io_u[2],
+                                       (unsigned long long) ts->total_io_u[3],
                                        (unsigned long long) ts->short_io_u[0],
                                        (unsigned long long) ts->short_io_u[1],
                                        (unsigned long long) ts->short_io_u[2],
@@ -1609,6 +1610,8 @@ void sum_thread_stats(struct thread_stat *dst, struct thread_stat *src,
                }
        }
 
+       dst->total_io_u[DDIR_SYNC] += src->total_io_u[DDIR_SYNC];
+
        for (k = 0; k < DDIR_RWDIR_CNT; k++) {
                int m;
 
@@ -1647,6 +1650,7 @@ void init_thread_stat(struct thread_stat *ts)
                ts->bw_stat[j].min_val = -1UL;
                ts->iops_stat[j].min_val = -1UL;
        }
+       ts->sync_stat.min_val = -1UL;
        ts->groupid = -1;
 }
 
@@ -2287,6 +2291,8 @@ void reset_io_stats(struct thread_data *td)
                }
        }
 
+       ts->total_io_u[DDIR_SYNC] = 0;
+
        for (i = 0; i < FIO_IO_U_MAP_NR; i++) {
                ts->io_u_map[i] = 0;
                ts->io_u_submit[i] = 0;
diff --git a/stat.h b/stat.h
index e32a21ec55f2453c73ad2aad4faf580ee7fb18ff..fd5131f9cc80a3d91492941829ca641e1e500b0e 100644 (file)
--- a/stat.h
+++ b/stat.h
@@ -192,7 +192,7 @@ struct thread_stat {
        uint32_t io_u_sync_plat[FIO_IO_U_PLAT_NR];
        uint32_t pad;
 
-       uint64_t total_io_u[DDIR_RWDIR_CNT];
+       uint64_t total_io_u[DDIR_RWDIR_SYNC_CNT];
        uint64_t short_io_u[DDIR_RWDIR_CNT];
        uint64_t drop_io_u[DDIR_RWDIR_CNT];
        uint64_t total_submit;