[Ocfs2-devel] [patch 16/28] ocfs2: use 64bit variables to track heartbeat time

Mark Fasheh mfasheh at suse.de
Mon Aug 31 12:54:33 PDT 2015


On Wed, Aug 26, 2015 at 03:12:03PM -0700, Andrew Morton wrote:
> From: Tina Ruchandani <ruchandani.tina at gmail.com>
> Subject: ocfs2: use 64bit variables to track heartbeat time
> 
> o2hb_elapsed_msecs computes the time taken for a disk heartbeat.  'struct
> timeval' variables are used to store start and end times.  On 32-bit
> systems, the 'tv_sec' component of 'struct timeval' will overflow in year
> 2038 and beyond.
> 
> This patch solves the overflow with the following:
> 
> 1. Replace o2hb_elapsed_msecs using 'ktime_t' values to measure start
>    and end time, and built-in function 'ktime_ms_delta' to compute the
>    elapsed time.  ktime_get_real() is used since the code prints out the
>    wallclock time.
> 
> 2. Changes format string to print time as a single 64-bit nanoseconds
>    value ("%lld") instead of seconds and microseconds.  This simplifies
>    the code since converting ktime_t to that format would need expensive
>    computation.  However, the debug log string is less readable than the
>    previous format.
> 
> Signed-off-by: Tina Ruchandani <ruchandani.tina at gmail.com>
> Suggested by: Arnd Bergmann <arnd at arndb.de>
> Cc: Mark Fasheh <mfasheh at suse.com>
> Cc: Joel Becker <jlbec at evilplan.org>
> Signed-off-by: Andrew Morton <akpm at linux-foundation.org>

Reviewed-by: Mark Fasheh <mfasheh at suse.de>

--
Mark Fasheh



More information about the Ocfs2-devel mailing list