From 739361503edb092a7e3710cdb0aa7c2c7a3a66d9 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 30 Mar 2017 09:32:59 -0400 Subject: [PATCH] LU-4423 osc: use 64-bit timestamps in debugfs output Some lustre debugfs files contain the current time. Make sure we use a format here that does not overflow in 2038. Linux-commit: 86655400c6e74751a73be82ea40d5ae6979c3225 Change-Id: I8a79e60bd15ce7c162b30025ca3b572fec2ee58f Signed-off-by: Arnd Bergmann Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/25407 Reviewed-by: Jinshan Xiong Reviewed-by: Dmitry Eremin Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/osc/lproc_osc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index b77ccf1..a71fb0f 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -690,18 +690,18 @@ struct lprocfs_vars lprocfs_osc_obd_vars[] = { static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v) { - struct timeval now; + struct timespec64 now; struct obd_device *dev = seq->private; struct client_obd *cli = &dev->u.cli; unsigned long read_tot = 0, write_tot = 0, read_cum, write_cum; int i; - do_gettimeofday(&now); + ktime_get_real_ts64(&now); spin_lock(&cli->cl_loi_list_lock); - seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n", - now.tv_sec, now.tv_usec); + seq_printf(seq, "snapshot_time: %lld.%09lu (secs.nsecs)\n", + (s64)now.tv_sec, now.tv_nsec); seq_printf(seq, "read RPCs in flight: %d\n", cli->cl_r_in_flight); seq_printf(seq, "write RPCs in flight: %d\n", @@ -807,14 +807,14 @@ LPROC_SEQ_FOPS(osc_rpc_stats); static int osc_stats_seq_show(struct seq_file *seq, void *v) { - struct timeval now; + struct timespec64 now; struct obd_device *dev = seq->private; struct osc_stats *stats = &obd2osc_dev(dev)->od_stats; - do_gettimeofday(&now); + ktime_get_real_ts64(&now); - seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n", - now.tv_sec, now.tv_usec); + seq_printf(seq, "snapshot_time: %lld.%09lu (secs.nsecs)\n", + (s64)now.tv_sec, now.tv_nsec); seq_printf(seq, "lockless_write_bytes\t\t%llu\n", stats->os_lockless_writes); seq_printf(seq, "lockless_read_bytes\t\t%llu\n", -- 1.8.3.1