Whamcloud - gitweb
LU-11771 osd: avoid use of HZ in brw_stats 57/33857/2
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 14 Dec 2018 02:57:17 +0000 (19:57 -0700)
committerOleg Drokin <green@whamcloud.com>
Fri, 4 Jan 2019 04:49:15 +0000 (04:49 +0000)
Don't use HZ when computing the brw_stats IO time.  This brw_stats
field was formerly in jiffies, but since the conversion to ktime_t
(now always in msec) the output is incorrect when HZ != 1000.

Fixes: 4c2f028a95063aa30006a071a039e8a3eefe52f2

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ia01705b94ddedec2e375621c6e01a957f53ebbe5
Reviewed-on: https://review.whamcloud.com/33857
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Sergey Cheremencev <c17829@cray.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-ldiskfs/osd_lproc.c
lustre/osd-zfs/osd_io.c
lustre/osd-zfs/osd_lproc.c

index 85b2055..d1708a3 100644 (file)
@@ -148,8 +148,7 @@ static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats)
 
        display_brw_stats(seq, "I/O time (1/1000s)", "ios",
                          &brw_stats->hist[BRW_R_IO_TIME],
-                         &brw_stats->hist[BRW_W_IO_TIME],
-                         jiffies_to_msecs(1000) / MSEC_PER_SEC);
+                         &brw_stats->hist[BRW_W_IO_TIME], 1);
 
         display_brw_stats(seq, "disk I/O size", "ios",
                           &brw_stats->hist[BRW_R_DISK_IOSIZE],
index b836536..ed3c92c 100644 (file)
@@ -94,22 +94,16 @@ static void record_end_io(struct osd_device *osd, int rw,
 {
        struct obd_histogram *h = osd->od_brw_stats.hist;
 
-       if (rw == READ) {
+       if (rw == READ)
                atomic_dec(&osd->od_r_in_flight);
-               lprocfs_oh_tally_log2(&h[BRW_R_PAGES], npages);
-               if (disksize > 0)
-                       lprocfs_oh_tally_log2(&h[BRW_R_DISK_IOSIZE], disksize);
-               if (elapsed)
-                       lprocfs_oh_tally_log2(&h[BRW_R_IO_TIME], elapsed);
-
-       } else {
+       else
                atomic_dec(&osd->od_w_in_flight);
-               lprocfs_oh_tally_log2(&h[BRW_W_PAGES], npages);
-               if (disksize > 0)
-                       lprocfs_oh_tally_log2(&h[BRW_W_DISK_IOSIZE], disksize);
-               if (elapsed)
-                       lprocfs_oh_tally_log2(&h[BRW_W_IO_TIME], elapsed);
-       }
+
+       lprocfs_oh_tally_log2(&h[BRW_R_PAGES + rw], npages);
+       if (disksize > 0)
+               lprocfs_oh_tally_log2(&h[BRW_R_DISK_IOSIZE + rw], disksize);
+       if (elapsed)
+               lprocfs_oh_tally_log2(&h[BRW_R_IO_TIME + rw], elapsed);
 }
 
 static ssize_t __osd_read(const struct lu_env *env, struct dt_object *dt,
index bedc478..895eb13 100644 (file)
@@ -115,7 +115,7 @@ static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats)
 
        display_brw_stats(seq, "I/O time (1/1000s)", "ios",
                          &brw_stats->hist[BRW_R_IO_TIME],
-                         &brw_stats->hist[BRW_W_IO_TIME], 1000 / HZ);
+                         &brw_stats->hist[BRW_W_IO_TIME], 1);
 
        display_brw_stats(seq, "disk I/O size", "ios",
                          &brw_stats->hist[BRW_R_DISK_IOSIZE],