staging/lustre: use 64-bit timestamps in debugfs output
authorArnd Bergmann <arnd@arndb.de>
Sun, 27 Sep 2015 20:45:05 +0000 (16:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 02:03:33 +0000 (04:03 +0200)
Some lustre debugfs files contain the current time. Make sure
we use a format here that does not overflow in 2038.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/osc/lproc_osc.c

index f3eb39fe85357602630899f6bf5a5738a87d7640..2a16046aac20839caeea1f27d6160a0fb400acfb 100644 (file)
@@ -594,18 +594,18 @@ static 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);
 
        client_obd_list_lock(&cli->cl_loi_list_lock);
 
-       seq_printf(seq, "snapshot_time:  %lu.%lu (secs.usecs)\n",
-                  now.tv_sec, (unsigned long)now.tv_usec);
+       seq_printf(seq, "snapshot_time:  %llu.%9lu (secs.usecs)\n",
+                  (s64)now.tv_sec, (unsigned long)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",
@@ -711,14 +711,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, (unsigned long)now.tv_usec);
+       seq_printf(seq, "snapshot_time:  %llu.%9lu (secs.usecs)\n",
+                  (s64)now.tv_sec, (unsigned long)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",