patch-2.4.23 linux-2.4.23/include/linux/sunrpc/timer.h

Next file: linux-2.4.23/include/linux/sunrpc/xprt.h
Previous file: linux-2.4.23/include/linux/sunrpc/svc.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.22/include/linux/sunrpc/timer.h linux-2.4.23/include/linux/sunrpc/timer.h
@@ -15,7 +15,7 @@
 	long timeo;		/* default timeout value */
 	long srtt[5];		/* smoothed round trip time << 3 */
 	long sdrtt[5];		/* soothed medium deviation of RTT */
-	atomic_t  ntimeouts;	/* Global count of the number of timeouts */
+	int  ntimeouts[5];	/* Number of timeouts for the last request */
 };
 
 
@@ -23,19 +23,27 @@
 extern void rpc_update_rtt(struct rpc_rtt *rt, int timer, long m);
 extern long rpc_calc_rto(struct rpc_rtt *rt, int timer);
 
-static inline void rpc_inc_timeo(struct rpc_rtt *rt)
+static inline void rpc_set_timeo(struct rpc_rtt *rt, int timer, int ntimeo)
 {
-	atomic_inc(&rt->ntimeouts);
+	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 void rpc_clear_timeo(struct rpc_rtt *rt)
+static inline int rpc_ntimeo(struct rpc_rtt *rt, int timer)
 {
-	atomic_set(&rt->ntimeouts, 0);
-}
-
-static inline int rpc_ntimeo(struct rpc_rtt *rt)
-{
-	return atomic_read(&rt->ntimeouts);
+	if (!timer)
+		return 0;
+	return rt->ntimeouts[timer-1];
 }
 
 #endif /* _LINUX_SUNRPC_TIMER_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)