From d6604b4a7d147602b4cab14e2353f860ba0f422e Mon Sep 17 00:00:00 2001 From: James Simmons Date: Fri, 17 Feb 2017 10:45:58 -0500 Subject: [PATCH] LU-9019 obd: use 64-bit timestamps for rpc stats MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The debugfs rpc 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: I8fca45ef62672f3880a444961cb068d8c436e2c7 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/25410 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Grégoire Pichon Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lustre/obdclass/genops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 54edf1d..9857a57 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -2155,16 +2155,16 @@ EXPORT_SYMBOL(obd_set_max_mod_rpcs_in_flight); int obd_mod_rpc_stats_seq_show(struct client_obd *cli, struct seq_file *seq) { - struct timeval now; unsigned long mod_tot = 0, mod_cum; + struct timespec64 now; int i; - do_gettimeofday(&now); + ktime_get_real_ts64(&now); spin_lock(&cli->cl_mod_rpcs_lock); - seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n", - now.tv_sec, now.tv_usec); + seq_printf(seq, "snapshot_time: %llu.%9lu (secs.nsecs)\n", + (s64)now.tv_sec, now.tv_nsec); seq_printf(seq, "modify_RPCs_in_flight: %hu\n", cli->cl_mod_rpcs_in_flight); -- 1.8.3.1