Skip to contentSkip to conversation

net: ipv4: fib_trie: Don't unnecessarily search for already found fib leaf

PATCH Applied [email protected] 2 participants 2 messages Aug 13, 2012 – Aug 14, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ipv4: fib_trie: Don't unnecessarily search for already found fib leaf

From: Igor Maravic <[email protected]>

We've already found leaf, don't search for it again. Same is for fib leaf info.

---
 net/ipv4/fib_trie.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
net/ipv4/fib_trie.c +6 -4
index 30b88d7..8063a8c 100644
@@ -1657,7 +1657,12 @@ int fib_table_delete(struct fib_table *tb, struct fib_config *cfg)
 	if (!l)
 		return -ESRCH;
 
-	fa_head = get_fa_head(l, plen);
+	li = find_leaf_info(l, plen);
+
+	if (!li)
+		return -ESRCH;
+
+	fa_head = &li->falh;
 	fa = fib_find_alias(fa_head, tos, 0);
 
 	if (!fa)
@@ -1693,9 +1698,6 @@ int fib_table_delete(struct fib_table *tb, struct fib_config *cfg)
 	rtmsg_fib(RTM_DELROUTE, htonl(key), fa, plen, tb->tb_id,
 		  &cfg->fc_nlinfo, 0);
 
-	l = fib_find_node(t, key);
-	li = find_leaf_info(l, plen);
-
 	list_del_rcu(&fa->fa_list);
 
 	if (!plen)
Signature · 1 line
1.7.9.5