diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/sunrpc/timer.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/linux/sunrpc/timer.h')
-rw-r--r-- | include/linux/sunrpc/timer.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/linux/sunrpc/timer.h b/include/linux/sunrpc/timer.h new file mode 100644 index 000000000000..a67fd734c73b --- /dev/null +++ b/include/linux/sunrpc/timer.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * linux/include/linux/sunrpc/timer.h | ||
3 | * | ||
4 | * Declarations for the RPC transport timer. | ||
5 | * | ||
6 | * Copyright (C) 2002 Trond Myklebust <trond.myklebust@fys.uio.no> | ||
7 | */ | ||
8 | |||
9 | #ifndef _LINUX_SUNRPC_TIMER_H | ||
10 | #define _LINUX_SUNRPC_TIMER_H | ||
11 | |||
12 | #include <asm/atomic.h> | ||
13 | |||
14 | struct rpc_rtt { | ||
15 | unsigned long timeo; /* default timeout value */ | ||
16 | unsigned long srtt[5]; /* smoothed round trip time << 3 */ | ||
17 | unsigned long sdrtt[5]; /* smoothed medium deviation of RTT */ | ||
18 | int ntimeouts[5]; /* Number of timeouts for the last request */ | ||
19 | }; | ||
20 | |||
21 | |||
22 | extern void rpc_init_rtt(struct rpc_rtt *rt, unsigned long timeo); | ||
23 | extern void rpc_update_rtt(struct rpc_rtt *rt, unsigned timer, long m); | ||
24 | extern unsigned long rpc_calc_rto(struct rpc_rtt *rt, unsigned timer); | ||
25 | |||
26 | static inline void rpc_set_timeo(struct rpc_rtt *rt, int timer, int ntimeo) | ||
27 | { | ||
28 | int *t; | ||
29 | if (!timer) | ||
30 | return; | ||
31 | t = &rt->ntimeouts[timer-1]; | ||
32 | if (ntimeo < *t) { | ||
33 | if (*t > 0) | ||
34 | (*t)--; | ||
35 | } else { | ||
36 | if (ntimeo > 8) | ||
37 | ntimeo = 8; | ||
38 | *t = ntimeo; | ||
39 | } | ||
40 | } | ||
41 | |||
42 | static inline int rpc_ntimeo(struct rpc_rtt *rt, int timer) | ||
43 | { | ||
44 | if (!timer) | ||
45 | return 0; | ||
46 | return rt->ntimeouts[timer-1]; | ||
47 | } | ||
48 | |||
49 | #endif /* _LINUX_SUNRPC_TIMER_H */ | ||