Skip to content

Commit

Permalink
fib_trie: Minor cleanups to fib_table_flush_external
Browse files Browse the repository at this point in the history
This change just does a couple of minor cleanups on
fib_table_flush_external.  Specifically it addresses the fact that resize
was being called even though nothing was being removed from the table, and
it drops an unecessary indent since we could just call continue on the
inverse of the fi && flag check.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alexander Duyck authored and David S. Miller committed Mar 6, 2015
1 parent 2048823 commit 72be726
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -1586,13 +1586,8 @@ void fib_table_flush_external(struct fib_table *tb)
while (!(cindex--)) {
t_key pkey = pn->key;

n = pn;
pn = node_parent(n);

/* resize completed node */
resize(t, n);

/* if we got the root we are done */
pn = node_parent(pn);
if (!pn)
return;

Expand All @@ -1607,12 +1602,13 @@ void fib_table_flush_external(struct fib_table *tb)
hlist_for_each_entry(fa, &n->leaf, fa_list) {
struct fib_info *fi = fa->fa_info;

if (fi && (fi->fib_flags & RTNH_F_EXTERNAL)) {
netdev_switch_fib_ipv4_del(n->key,
KEYLENGTH - fa->fa_slen,
fi, fa->fa_tos,
fa->fa_type, tb->tb_id);
}
if (!fi || !(fi->fib_flags & RTNH_F_EXTERNAL))
continue;

netdev_switch_fib_ipv4_del(n->key,
KEYLENGTH - fa->fa_slen,
fi, fa->fa_tos,
fa->fa_type, tb->tb_id);
}

/* if trie is leaf only loop is completed */
Expand Down

0 comments on commit 72be726

Please sign in to comment.