From: Andreas Dilger Date: Fri, 14 Dec 2018 02:57:17 +0000 (-0700) Subject: LU-11771 osd: avoid use of HZ in brw_stats X-Git-Tag: 2.12.51~66 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=8d83e946bc96df6535d9f501db400e2196a45668;ds=sidebyside LU-11771 osd: avoid use of HZ in brw_stats 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 Change-Id: Ia01705b94ddedec2e375621c6e01a957f53ebbe5 Reviewed-on: https://review.whamcloud.com/33857 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Sergey Cheremencev Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c index 85b2055..d1708a3 100644 --- a/lustre/osd-ldiskfs/osd_lproc.c +++ b/lustre/osd-ldiskfs/osd_lproc.c @@ -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], diff --git a/lustre/osd-zfs/osd_io.c b/lustre/osd-zfs/osd_io.c index b836536..ed3c92c 100644 --- a/lustre/osd-zfs/osd_io.c +++ b/lustre/osd-zfs/osd_io.c @@ -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, diff --git a/lustre/osd-zfs/osd_lproc.c b/lustre/osd-zfs/osd_lproc.c index bedc478..895eb13 100644 --- a/lustre/osd-zfs/osd_lproc.c +++ b/lustre/osd-zfs/osd_lproc.c @@ -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],