[prev in list] [next in list] [prev in thread] [next in thread] 

List:       autofs
Subject:    Re: [PATCH 2/3] Fix monotonic_elapsed.
From:       Ian Kent <raven () themaw ! net>
Date:       2018-01-29 8:31:22
Message-ID: 01c5cfdd-afbe-979e-d190-39f393d1d901 () themaw ! net
[Download RAW message or body]

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




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic