From: James Simmons Date: Sun, 12 Feb 2017 17:39:33 +0000 (-0500) Subject: LU-9019 mdt: use 64-bit timestamps for rename stats X-Git-Tag: 2.9.54~40 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=1f58cac8e4a7f5196ceab2a411bd11d152de27e4 LU-9019 mdt: use 64-bit timestamps for rename stats The rename 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: I3b395160d8f5c76553f20dc4ca1047ae2a3df2b6 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/25412 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c index 0e3e939..7c34b80 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -112,13 +112,13 @@ static void display_rename_stats(struct seq_file *seq, char *name, static void rename_stats_show(struct seq_file *seq, struct rename_stats *rename_stats) { - struct timeval now; + struct timespec64 now; - /* this sampling races with updates */ - do_gettimeofday(&now); - seq_printf(seq, "rename_stats:\n"); - seq_printf(seq, "- %-15s %lu.%lu\n", "snapshot_time:", - now.tv_sec, now.tv_usec); + /* this sampling races with updates */ + ktime_get_real_ts64(&now); + seq_printf(seq, "rename_stats:\n"); + seq_printf(seq, "- %-15s %llu.%9lu\n", "snapshot_time:", + (s64)now.tv_sec, now.tv_nsec); display_rename_stats(seq, "same_dir", &rename_stats->hist[RENAME_SAMEDIR_SIZE]);