Re: [PATCH 2/3] Fix monotonic_elapsed.

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

 



On 29/01/18 15:19, NeilBrown wrote:
> When automount probes multiple hosts to find the one which
> responds most quickly, it currently ignores the nanoseconds.
> This often makes the cost "0", which makes weights ineffective.
> 
> The cause is that monotonic_elapsed() casts tv_nsec to a
> double *after* dividing by 1 billion, rather than before.
> 
> With this change, weights become effective for choosing
> between hosts which respond in under one second.

Yes, when I looked I saw this was part of the series to change
to using the monotonic clock in order to avoid problems with
discontinuous jumps in system time.

I completely missed this when I reviewed the series.

Thanks Neil.

Umm ... I don't see patches 1 and 3, maybe they got lost in the
ether or they'll arrive later .... 
 
> 
> Signed-off-by: NeilBrown <neilb@xxxxxxxx>
> ---
>  lib/rpc_subs.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
> index 73097c9d4238..60ede9f8c085 100644
> --- a/lib/rpc_subs.c
> +++ b/lib/rpc_subs.c
> @@ -1093,9 +1093,9 @@ double monotonic_elapsed(struct timespec start, struct timespec end)
>  	double t1, t2;
>  
>  	t1 =  (double) start.tv_sec +
> -		(double) (start.tv_nsec/(1000*1000*1000));
> +		((double) start.tv_nsec/(1000*1000*1000));
>  	t2 =  (double) end.tv_sec +
> -		(double) (end.tv_nsec/(1000*1000*1000));
> +		((double) end.tv_nsec/(1000*1000*1000));
>  	return t2 - t1;
>  }
>  
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe autofs" in
> 

--
To unsubscribe from this list: send the line "unsubscribe autofs" in



[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux