net: ipv4: fib_trie: Don't unnecessarily search for already found fib leaf
authorIgor Maravic <igorm@etf.rs>
Mon, 13 Aug 2012 08:26:08 +0000 (10:26 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Aug 2012 22:02:20 +0000 (15:02 -0700)
We've already found leaf, don't search for it again. Same is for fib leaf info.

Signed-off-by: Igor Maravic <igorm@etf.rs>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/fib_trie.c

index f84a0e90d675e334a3010e0038a2ee85b9cf846c..4587d344046d657157a6cccd62ef6f7dfa4648fc 100644 (file)
@@ -1656,7 +1656,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)
@@ -1692,9 +1697,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)