From d1f68d84f2cfdc3cf0f902fc3b44a181795648e5 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 1 Mar 2017 10:35:49 -0500 Subject: [PATCH] LU-9019 zfs: use 64-bit timestamps for brw stats The debugfs brw stats interface contains timestamps that are computed from timeval, which overflows in 2038 on 32-bit systems. This changes the output to use a timespec64 type to avoid the overflow. I also change the format to print the sub-second portion as 9 digits (nanoseconds) for clarity, rather than printing six digits without leading zeroes. Change-Id: I34f3b02a0d5f80e9ae22a47f55445199332b3dc9 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/25411 Reviewed-by: John L. Hammond Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin --- lustre/osd-zfs/osd_lproc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lustre/osd-zfs/osd_lproc.c b/lustre/osd-zfs/osd_lproc.c index 459a000..e3fd0e9 100644 --- a/lustre/osd-zfs/osd_lproc.c +++ b/lustre/osd-zfs/osd_lproc.c @@ -89,12 +89,12 @@ static void display_brw_stats(struct seq_file *seq, char *name, char *units, static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats) { - struct timeval now; + struct timespec64 now; /* this sampling races with updates */ - do_gettimeofday(&now); - seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n", - now.tv_sec, now.tv_usec); + ktime_get_real_ts64(&now); + seq_printf(seq, "snapshot_time: %llu.%09lu (secs.nsecs)\n", + (s64)now.tv_sec, now.tv_nsec); display_brw_stats(seq, "pages per bulk r/w", "rpcs", &brw_stats->hist[BRW_R_PAGES], -- 1.8.3.1