[IPV4]: fib_trie RCU refinements

* This patch is from Paul McKenney's RCU reviewing.

Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Robert Olsson and committed by David S. Miller 772cb712 1d25cd6c

+10 -11
+10 -11
net/ipv4/fib_trie.c
··· 43 43 * 2 of the License, or (at your option) any later version. 44 44 */ 45 45 46 - #define VERSION "0.403" 46 + #define VERSION "0.404" 47 47 48 48 #include <linux/config.h> 49 49 #include <asm/uaccess.h> ··· 224 224 Consider a node 'n' and its parent 'tp'. 225 225 226 226 If n is a leaf, every bit in its key is significant. Its presence is 227 - necessitaded by path compression, since during a tree traversal (when 227 + necessitated by path compression, since during a tree traversal (when 228 228 searching for a leaf - unless we are doing an insertion) we will completely 229 229 ignore all skipped bits we encounter. Thus we need to verify, at the end of 230 230 a potentially successful search, that we have indeed been walking the ··· 836 836 #endif 837 837 } 838 838 839 - /* readside most use rcu_read_lock currently dump routines 839 + /* readside must use rcu_read_lock currently dump routines 840 840 via get_fa_head and dump */ 841 841 842 - static struct leaf_info *find_leaf_info(struct hlist_head *head, int plen) 842 + static struct leaf_info *find_leaf_info(struct leaf *l, int plen) 843 843 { 844 + struct hlist_head *head = &l->list; 844 845 struct hlist_node *node; 845 846 struct leaf_info *li; 846 847 ··· 854 853 855 854 static inline struct list_head * get_fa_head(struct leaf *l, int plen) 856 855 { 857 - struct leaf_info *li = find_leaf_info(&l->list, plen); 856 + struct leaf_info *li = find_leaf_info(l, plen); 858 857 859 858 if (!li) 860 859 return NULL; ··· 1249 1248 } 1250 1249 1251 1250 1252 - /* should be clalled with rcu_read_lock */ 1251 + /* should be called with rcu_read_lock */ 1253 1252 static inline int check_leaf(struct trie *t, struct leaf *l, 1254 1253 t_key key, int *plen, const struct flowi *flp, 1255 1254 struct fib_result *res) ··· 1591 1590 rtmsg_fib(RTM_DELROUTE, htonl(key), fa, plen, tb->tb_id, nlhdr, req); 1592 1591 1593 1592 l = fib_find_node(t, key); 1594 - li = find_leaf_info(&l->list, plen); 1593 + li = find_leaf_info(l, plen); 1595 1594 1596 1595 list_del_rcu(&fa->fa_list); 1597 1596 ··· 1715 1714 1716 1715 t->revision++; 1717 1716 1718 - rcu_read_lock(); 1719 1717 for (h = 0; (l = nextleaf(t, l)) != NULL; h++) { 1720 1718 found += trie_flush_leaf(t, l); 1721 1719 ··· 1722 1722 trie_leaf_remove(t, ll->key); 1723 1723 ll = l; 1724 1724 } 1725 - rcu_read_unlock(); 1726 1725 1727 1726 if (ll && hlist_empty(&ll->list)) 1728 1727 trie_leaf_remove(t, ll->key); ··· 2287 2288 seq_indent(seq, iter->depth); 2288 2289 seq_printf(seq, " |-- %d.%d.%d.%d\n", NIPQUAD(val)); 2289 2290 for (i = 32; i >= 0; i--) { 2290 - struct leaf_info *li = find_leaf_info(&l->list, i); 2291 + struct leaf_info *li = find_leaf_info(l, i); 2291 2292 if (li) { 2292 2293 struct fib_alias *fa; 2293 2294 list_for_each_entry_rcu(fa, &li->falh, fa_list) { ··· 2383 2384 return 0; 2384 2385 2385 2386 for (i=32; i>=0; i--) { 2386 - struct leaf_info *li = find_leaf_info(&l->list, i); 2387 + struct leaf_info *li = find_leaf_info(l, i); 2387 2388 struct fib_alias *fa; 2388 2389 u32 mask, prefix; 2389 2390