Re: [PATCH 25/73] staging/lustre: use 64-bit times in debug print

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2015/09/27, 10:45 PM, "green@xxxxxxxxxxxxxx" <green@xxxxxxxxxxxxxx>
wrote:

>From: Arnd Bergmann <arnd@xxxxxxxx>
>
>This adapts the format string and get_seconds() call to not
>overflow in 2038 in the libcfs_debug_dumplog_internal()
>function.
>
>Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
>Signed-off-by: Oleg Drokin <green@xxxxxxxxxxxxxx>
>---
> drivers/staging/lustre/lustre/libcfs/debug.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c
>b/drivers/staging/lustre/lustre/libcfs/debug.c
>index e93f556..ae325f7 100644
>--- a/drivers/staging/lustre/lustre/libcfs/debug.c
>+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
>@@ -452,8 +452,8 @@ void libcfs_debug_dumplog_internal(void *arg)
> 
> 	if (strncmp(libcfs_debug_file_path_arr, "NONE", 4) != 0) {
> 		snprintf(debug_file_name, sizeof(debug_file_name) - 1,
>-			 "%s.%ld.%ld", libcfs_debug_file_path_arr,
>-			 get_seconds(), (long_ptr_t)arg);
>+			 "%s.%lld.%ld", libcfs_debug_file_path_arr,
>+			 (s64)ktime_get_real_seconds(), (long_ptr_t)arg);

One question about all of these patches - is "s64" always a "long long" or
might it be just a "long" on some 64-bit platforms?  I recall times in the
past where you needed to cast a __u64 to (unsigned long long) to avoid
compiler warnings when using "%llu" in printk(), but maybe things have
changed?  Otherwise, all of these patches need to be redone to cast the
variables to "long long" before printing.

Cheers, Andreas

> 		pr_alert("LustreError: dumping log to %s\n",
> 		       debug_file_name);
> 		cfs_tracefile_dump_all_pages(debug_file_name);
>-- 
>2.1.0
>
>


Cheers, Andreas
-- 
Andreas Dilger

Lustre Software Architect
Intel High Performance Data Division


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux