aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inetpeer.c
diff options
context:
space:
mode:
authorWillem de Bruijn <willemb@google.com>2014-09-08 19:08:34 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-08 19:42:42 -0400
commita7f26b7e1ee73ac9e766c430fea5af658d839954 (patch)
tree24ddbc5f3052e033a8721d0b0ef27b425823123f /net/ipv4/inetpeer.c
parent1923d6e4186c9470a83d0179e86e1aea8cfcbe67 (diff)
inet: remove dead inetpeer sequence code
inetpeer sequence numbers are no longer incremented, so no need to check and flush the tree. The function that increments the sequence number was already dead code and removed in in "ipv4: remove unused function" (068a6e18). Remove the code that checks for a change, too. Verifying that v4_seq and v6_seq are never incremented and thus that flush_check compares bp->flush_seq to 0 is trivial. The second part of the change removes flush_check completely even though bp->flush_seq is exactly !0 once, at initialization. This change is correct because the time this branch is true is when bp->root == peer_avl_empty_rcu, in which the branch and inetpeer_invalidate_tree are a NOOP. Signed-off-by: Willem de Bruijn <willemb@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inetpeer.c')
-rw-r--r--net/ipv4/inetpeer.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index bd5f5928167d..241afd743d2c 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -72,29 +72,10 @@ void inet_peer_base_init(struct inet_peer_base *bp)
72{ 72{
73 bp->root = peer_avl_empty_rcu; 73 bp->root = peer_avl_empty_rcu;
74 seqlock_init(&bp->lock); 74 seqlock_init(&bp->lock);
75 bp->flush_seq = ~0U;
76 bp->total = 0; 75 bp->total = 0;
77} 76}
78EXPORT_SYMBOL_GPL(inet_peer_base_init); 77EXPORT_SYMBOL_GPL(inet_peer_base_init);
79 78
80static atomic_t v4_seq = ATOMIC_INIT(0);
81static atomic_t v6_seq = ATOMIC_INIT(0);
82
83static atomic_t *inetpeer_seq_ptr(int family)
84{
85 return (family == AF_INET ? &v4_seq : &v6_seq);
86}
87
88static inline void flush_check(struct inet_peer_base *base, int family)
89{
90 atomic_t *fp = inetpeer_seq_ptr(family);
91
92 if (unlikely(base->flush_seq != atomic_read(fp))) {
93 inetpeer_invalidate_tree(base);
94 base->flush_seq = atomic_read(fp);
95 }
96}
97
98#define PEER_MAXDEPTH 40 /* sufficient for about 2^27 nodes */ 79#define PEER_MAXDEPTH 40 /* sufficient for about 2^27 nodes */
99 80
100/* Exported for sysctl_net_ipv4. */ 81/* Exported for sysctl_net_ipv4. */
@@ -444,8 +425,6 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base,
444 unsigned int sequence; 425 unsigned int sequence;
445 int invalidated, gccnt = 0; 426 int invalidated, gccnt = 0;
446 427
447 flush_check(base, daddr->family);
448
449 /* Attempt a lockless lookup first. 428 /* Attempt a lockless lookup first.
450 * Because of a concurrent writer, we might not find an existing entry. 429 * Because of a concurrent writer, we might not find an existing entry.
451 */ 430 */