Commit 74e489aa authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

staging/lustre: use 64-bit time for debugfs output

This time is only printed in debugfs, and can be easily converted
to 64-bit to avoid overflowing on 32-bit systems in 2038.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8f83409c
...@@ -148,7 +148,7 @@ struct obd_import_conn { ...@@ -148,7 +148,7 @@ struct obd_import_conn {
#define IMP_STATE_HIST_LEN 16 #define IMP_STATE_HIST_LEN 16
struct import_state_hist { struct import_state_hist {
enum lustre_imp_state ish_state; enum lustre_imp_state ish_state;
time_t ish_time; time64_t ish_time;
}; };
/** /**
...@@ -307,7 +307,7 @@ struct obd_import { ...@@ -307,7 +307,7 @@ struct obd_import {
__u32 imp_msghdr_flags; /* adjusted based on server capability */ __u32 imp_msghdr_flags; /* adjusted based on server capability */
struct imp_at imp_at; /* adaptive timeout data */ struct imp_at imp_at; /* adaptive timeout data */
time_t imp_last_reply_time; /* for health check */ time64_t imp_last_reply_time; /* for health check */
}; };
typedef void (*obd_import_callback)(struct obd_import *imp, void *closure, typedef void (*obd_import_callback)(struct obd_import *imp, void *closure,
......
...@@ -846,8 +846,7 @@ int lprocfs_rd_state(struct seq_file *m, void *data) ...@@ -846,8 +846,7 @@ int lprocfs_rd_state(struct seq_file *m, void *data)
&imp->imp_state_hist[(k + j) % IMP_STATE_HIST_LEN]; &imp->imp_state_hist[(k + j) % IMP_STATE_HIST_LEN];
if (ish->ish_state == 0) if (ish->ish_state == 0)
continue; continue;
seq_printf(m, " - ["CFS_TIME_T", %s]\n", seq_printf(m, " - [%lld, %s]\n", (s64)ish->ish_time,
ish->ish_time,
ptlrpc_import_state_name(ish->ish_state)); ptlrpc_import_state_name(ish->ish_state));
} }
...@@ -872,7 +871,7 @@ int lprocfs_rd_timeouts(struct seq_file *m, void *data) ...@@ -872,7 +871,7 @@ int lprocfs_rd_timeouts(struct seq_file *m, void *data)
struct obd_device *obd = (struct obd_device *)data; struct obd_device *obd = (struct obd_device *)data;
struct obd_import *imp; struct obd_import *imp;
unsigned int cur, worst; unsigned int cur, worst;
time_t now, worstt; time64_t now, worstt;
struct dhms ts; struct dhms ts;
int i; int i;
...@@ -880,19 +879,19 @@ int lprocfs_rd_timeouts(struct seq_file *m, void *data) ...@@ -880,19 +879,19 @@ int lprocfs_rd_timeouts(struct seq_file *m, void *data)
LPROCFS_CLIMP_CHECK(obd); LPROCFS_CLIMP_CHECK(obd);
imp = obd->u.cli.cl_import; imp = obd->u.cli.cl_import;
now = get_seconds(); now = ktime_get_real_seconds();
/* Some network health info for kicks */ /* Some network health info for kicks */
s2dhms(&ts, now - imp->imp_last_reply_time); s2dhms(&ts, now - imp->imp_last_reply_time);
seq_printf(m, "%-10s : %ld, "DHMS_FMT" ago\n", seq_printf(m, "%-10s : %lld, " DHMS_FMT " ago\n",
"last reply", imp->imp_last_reply_time, DHMS_VARS(&ts)); "last reply", (s64)imp->imp_last_reply_time, DHMS_VARS(&ts));
cur = at_get(&imp->imp_at.iat_net_latency); cur = at_get(&imp->imp_at.iat_net_latency);
worst = imp->imp_at.iat_net_latency.at_worst_ever; worst = imp->imp_at.iat_net_latency.at_worst_ever;
worstt = imp->imp_at.iat_net_latency.at_worst_time; worstt = imp->imp_at.iat_net_latency.at_worst_time;
s2dhms(&ts, now - worstt); s2dhms(&ts, now - worstt);
seq_printf(m, "%-10s : cur %3u worst %3u (at %ld, "DHMS_FMT" ago) ", seq_printf(m, "%-10s : cur %3u worst %3u (at %lld, " DHMS_FMT " ago) ",
"network", cur, worst, worstt, DHMS_VARS(&ts)); "network", cur, worst, (s64)worstt, DHMS_VARS(&ts));
lprocfs_at_hist_helper(m, &imp->imp_at.iat_net_latency); lprocfs_at_hist_helper(m, &imp->imp_at.iat_net_latency);
for (i = 0; i < IMP_AT_MAX_PORTALS; i++) { for (i = 0; i < IMP_AT_MAX_PORTALS; i++) {
...@@ -902,9 +901,9 @@ int lprocfs_rd_timeouts(struct seq_file *m, void *data) ...@@ -902,9 +901,9 @@ int lprocfs_rd_timeouts(struct seq_file *m, void *data)
worst = imp->imp_at.iat_service_estimate[i].at_worst_ever; worst = imp->imp_at.iat_service_estimate[i].at_worst_ever;
worstt = imp->imp_at.iat_service_estimate[i].at_worst_time; worstt = imp->imp_at.iat_service_estimate[i].at_worst_time;
s2dhms(&ts, now - worstt); s2dhms(&ts, now - worstt);
seq_printf(m, "portal %-2d : cur %3u worst %3u (at %ld, " seq_printf(m, "portal %-2d : cur %3u worst %3u (at %lld, "
DHMS_FMT" ago) ", imp->imp_at.iat_portal[i], DHMS_FMT " ago) ", imp->imp_at.iat_portal[i],
cur, worst, worstt, DHMS_VARS(&ts)); cur, worst, (s64)worstt, DHMS_VARS(&ts));
lprocfs_at_hist_helper(m, &imp->imp_at.iat_service_estimate[i]); lprocfs_at_hist_helper(m, &imp->imp_at.iat_service_estimate[i]);
} }
...@@ -1190,11 +1189,12 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v) ...@@ -1190,11 +1189,12 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v)
int idx = *(loff_t *)v; int idx = *(loff_t *)v;
if (idx == 0) { if (idx == 0) {
struct timeval now; struct timespec64 now;
do_gettimeofday(&now);
seq_printf(p, "%-25s %lu.%lu secs.usecs\n", ktime_get_real_ts64(&now);
seq_printf(p, "%-25s %llu.%9lu secs.usecs\n",
"snapshot_time", "snapshot_time",
now.tv_sec, (unsigned long)now.tv_usec); (s64)now.tv_sec, (unsigned long)now.tv_nsec);
} }
hdr = &stats->ls_cnt_header[idx]; hdr = &stats->ls_cnt_header[idx];
......
...@@ -158,7 +158,7 @@ void reply_in_callback(lnet_event_t *ev) ...@@ -158,7 +158,7 @@ void reply_in_callback(lnet_event_t *ev)
ev->mlength, ev->offset, req->rq_replen); ev->mlength, ev->offset, req->rq_replen);
} }
req->rq_import->imp_last_reply_time = get_seconds(); req->rq_import->imp_last_reply_time = ktime_get_real_seconds();
out_wake: out_wake:
/* NB don't unlock till after wakeup; req can disappear under us /* NB don't unlock till after wakeup; req can disappear under us
......
...@@ -79,7 +79,7 @@ static void __import_set_state(struct obd_import *imp, ...@@ -79,7 +79,7 @@ static void __import_set_state(struct obd_import *imp,
imp->imp_state = state; imp->imp_state = state;
imp->imp_state_hist[imp->imp_state_hist_idx].ish_state = state; imp->imp_state_hist[imp->imp_state_hist_idx].ish_state = state;
imp->imp_state_hist[imp->imp_state_hist_idx].ish_time = imp->imp_state_hist[imp->imp_state_hist_idx].ish_time =
get_seconds(); ktime_get_real_seconds();
imp->imp_state_hist_idx = (imp->imp_state_hist_idx + 1) % imp->imp_state_hist_idx = (imp->imp_state_hist_idx + 1) %
IMP_STATE_HIST_LEN; IMP_STATE_HIST_LEN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment