The following commit has been merged in the master branch: commit 37b8d139a7c842de547ae1e75bbca5dbc443fa60 Author: Marek Lindner lindner_marek@yahoo.de Date: Sun Nov 7 12:56:57 2010 +0000
batman-adv: remove redundant gw_node_list_free() function
Signed-off-by: Marek Lindner lindner_marek@yahoo.de
diff --git a/gateway_client.c b/gateway_client.c index 24c12b4..e10dc90 100644 --- a/gateway_client.c +++ b/gateway_client.c @@ -305,7 +305,7 @@ void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node) return gw_node_update(bat_priv, orig_node, 0); }
-void gw_node_purge_deleted(struct bat_priv *bat_priv) +void gw_node_purge(struct bat_priv *bat_priv) { struct gw_node *gw_node; struct hlist_node *node, *node_tmp; @@ -314,32 +314,20 @@ void gw_node_purge_deleted(struct bat_priv *bat_priv) spin_lock_bh(&bat_priv->gw_list_lock);
hlist_for_each_entry_safe(gw_node, node, node_tmp, - &bat_priv->gw_list, list) { - if ((gw_node->deleted) && - (time_after(jiffies, gw_node->deleted + timeout))) { - - hlist_del_rcu(&gw_node->list); - call_rcu(&gw_node->rcu, gw_node_free_rcu); - } - } - - spin_unlock_bh(&bat_priv->gw_list_lock); -} - -void gw_node_list_free(struct bat_priv *bat_priv) -{ - struct gw_node *gw_node; - struct hlist_node *node, *node_tmp; + &bat_priv->gw_list, list) { + if (((!gw_node->deleted) || + (time_before(jiffies, gw_node->deleted + timeout))) && + atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE) + continue;
- spin_lock_bh(&bat_priv->gw_list_lock); + if (bat_priv->curr_gw == gw_node) + gw_deselect(bat_priv);
- hlist_for_each_entry_safe(gw_node, node, node_tmp, - &bat_priv->gw_list, list) { hlist_del_rcu(&gw_node->list); call_rcu(&gw_node->rcu, gw_node_free_rcu); }
- gw_deselect(bat_priv); + spin_unlock_bh(&bat_priv->gw_list_lock); }
diff --git a/gateway_client.h b/gateway_client.h index ce0b4f0..38699ba 100644 --- a/gateway_client.h +++ b/gateway_client.h @@ -29,8 +29,7 @@ void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node); void gw_node_update(struct bat_priv *bat_priv, struct orig_node *orig_node, uint8_t new_gwflags); void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node); -void gw_node_purge_deleted(struct bat_priv *bat_priv); -void gw_node_list_free(struct bat_priv *bat_priv); +void gw_node_purge(struct bat_priv *bat_priv); int gw_client_seq_print_text(struct seq_file *seq, void *offset); bool gw_is_target(struct bat_priv *bat_priv, struct sk_buff *skb);
diff --git a/main.c b/main.c index e4e4eca..c91e635 100644 --- a/main.c +++ b/main.c @@ -132,7 +132,7 @@ void mesh_free(struct net_device *soft_iface)
vis_quit(bat_priv);
- gw_node_list_free(bat_priv); + gw_node_purge(bat_priv); originator_free(bat_priv);
hna_local_free(bat_priv); diff --git a/originator.c b/originator.c index 8930446..89ec021 100644 --- a/originator.c +++ b/originator.c @@ -293,7 +293,7 @@ static void _purge_orig(struct bat_priv *bat_priv)
spin_unlock_bh(&bat_priv->orig_hash_lock);
- gw_node_purge_deleted(bat_priv); + gw_node_purge(bat_priv); gw_election(bat_priv);
softif_neigh_purge(bat_priv);