[PATCH 04/37] staging/lustre: tracefile: use 64-bit seconds
Arnd Bergmann
arnd at arndb.de
Wed Sep 23 19:13:27 UTC 2015
The lustre tracefile has a timestamp defined as
__u32 ph_sec;
__u64 ph_usec;
which seems completely backwards, as the microsecond portion of
a time stamp will always fit into a __u32 value, while the second
portion will overflow in 2038 or 2106 (in case of unsigned seconds).
This rectifies the situation by swapping out the types to have
64-bit seconds like everything else.
While this constitutes an ABI change, it seems to be reasonable
for a debugging interface to change and is likely what was
originally intended.
Signed-off-by: Arnd Bergmann <arnd at arndb.de>
---
drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h | 4 ++--
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
index a3aa644154e2..dfb81022397d 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
@@ -73,8 +73,8 @@ struct ptldebug_header {
__u32 ph_mask;
__u16 ph_cpu_id;
__u16 ph_type;
- __u32 ph_sec;
- __u64 ph_usec;
+ __u64 ph_sec;
+ __u32 ph_nsec;
__u32 ph_stack;
__u32 ph_pid;
__u32 ph_extern_pid;
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
index 87d844953522..fad272d559c4 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
@@ -191,16 +191,16 @@ cfs_set_ptldebug_header(struct ptldebug_header *header,
struct libcfs_debug_msg_data *msgdata,
unsigned long stack)
{
- struct timeval tv;
+ struct timespec64 ts;
- do_gettimeofday(&tv);
+ ktime_get_real_ts64(&ts);
header->ph_subsys = msgdata->msg_subsys;
header->ph_mask = msgdata->msg_mask;
header->ph_cpu_id = smp_processor_id();
header->ph_type = cfs_trace_buf_idx_get();
- header->ph_sec = (__u32)tv.tv_sec;
- header->ph_usec = tv.tv_usec;
+ header->ph_sec = ts.tv_sec;
+ header->ph_nsec = ts.tv_nsec;
header->ph_stack = stack;
header->ph_pid = current->pid;
header->ph_line_num = msgdata->msg_line;
--
2.1.0.rc2
More information about the devel
mailing list