 60063497a9
			
		
	
	
	60063497a9
	
	
	
		
			
			This allows us to move duplicated code in <asm/atomic.h> (atomic_inc_not_zero() for now) to <linux/atomic.h> Signed-off-by: Arun Sharma <asharma@fb.com> Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: David Miller <davem@davemloft.net> Cc: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
		
			
				
	
	
		
			49 lines
		
	
	
	
		
			1.1 KiB
			
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
	
		
			1.1 KiB
			
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  *  linux/include/linux/sunrpc/timer.h
 | |
|  *
 | |
|  *  Declarations for the RPC transport timer.
 | |
|  *
 | |
|  *  Copyright (C) 2002 Trond Myklebust <trond.myklebust@fys.uio.no>
 | |
|  */
 | |
| 
 | |
| #ifndef _LINUX_SUNRPC_TIMER_H
 | |
| #define _LINUX_SUNRPC_TIMER_H
 | |
| 
 | |
| #include <linux/atomic.h>
 | |
| 
 | |
| struct rpc_rtt {
 | |
| 	unsigned long timeo;	/* default timeout value */
 | |
| 	unsigned long srtt[5];	/* smoothed round trip time << 3 */
 | |
| 	unsigned long sdrtt[5];	/* smoothed medium deviation of RTT */
 | |
| 	int ntimeouts[5];	/* Number of timeouts for the last request */
 | |
| };
 | |
| 
 | |
| 
 | |
| extern void rpc_init_rtt(struct rpc_rtt *rt, unsigned long timeo);
 | |
| extern void rpc_update_rtt(struct rpc_rtt *rt, unsigned timer, long m);
 | |
| extern unsigned long rpc_calc_rto(struct rpc_rtt *rt, unsigned timer);
 | |
| 
 | |
| static inline void rpc_set_timeo(struct rpc_rtt *rt, int timer, int ntimeo)
 | |
| {
 | |
| 	int *t;
 | |
| 	if (!timer)
 | |
| 		return;
 | |
| 	t = &rt->ntimeouts[timer-1];
 | |
| 	if (ntimeo < *t) {
 | |
| 		if (*t > 0)
 | |
| 			(*t)--;
 | |
| 	} else {
 | |
| 		if (ntimeo > 8)
 | |
| 			ntimeo = 8;
 | |
| 		*t = ntimeo;
 | |
| 	}
 | |
| }
 | |
| 
 | |
| static inline int rpc_ntimeo(struct rpc_rtt *rt, int timer)
 | |
| {
 | |
| 	if (!timer)
 | |
| 		return 0;
 | |
| 	return rt->ntimeouts[timer-1];
 | |
| }
 | |
| 
 | |
| #endif /* _LINUX_SUNRPC_TIMER_H */
 |