diff options
author | Jon Maloy <jon.maloy@ericsson.com> | 2018-03-15 11:48:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-17 17:11:46 -0400 |
commit | 935439cc48ef24f0e50396be3684a0f27e609363 (patch) | |
tree | 9a68c3f65589d9349301c08f897cc65d769f7163 /net | |
parent | ba765ec63786583e210b55073a908a9d7ea284fa (diff) |
tipc: merge two lists in struct publication
The size of struct publication can be reduced further. Membership in
lists 'nodesub_list' and 'local_list' is mutually exlusive, in that
remote publications use the former and local publications the latter.
We replace the two lists with one single, named 'binding_node' which
reflects what it really is.
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/tipc/name_distr.c | 20 | ||||
-rw-r--r-- | net/tipc/name_table.h | 5 |
2 files changed, 12 insertions, 13 deletions
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 11ce20505550..4c54fb37875a 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
@@ -91,10 +91,10 @@ struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ) | |||
91 | struct sk_buff *skb; | 91 | struct sk_buff *skb; |
92 | 92 | ||
93 | if (publ->scope == TIPC_NODE_SCOPE) { | 93 | if (publ->scope == TIPC_NODE_SCOPE) { |
94 | list_add_tail_rcu(&publ->local_list, &nt->node_scope); | 94 | list_add_tail_rcu(&publ->binding_node, &nt->node_scope); |
95 | return NULL; | 95 | return NULL; |
96 | } | 96 | } |
97 | list_add_tail_rcu(&publ->local_list, &nt->cluster_scope); | 97 | list_add_tail_rcu(&publ->binding_node, &nt->cluster_scope); |
98 | 98 | ||
99 | skb = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0); | 99 | skb = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0); |
100 | if (!skb) { | 100 | if (!skb) { |
@@ -115,7 +115,7 @@ struct sk_buff *tipc_named_withdraw(struct net *net, struct publication *publ) | |||
115 | struct sk_buff *buf; | 115 | struct sk_buff *buf; |
116 | struct distr_item *item; | 116 | struct distr_item *item; |
117 | 117 | ||
118 | list_del(&publ->local_list); | 118 | list_del(&publ->binding_node); |
119 | 119 | ||
120 | if (publ->scope == TIPC_NODE_SCOPE) | 120 | if (publ->scope == TIPC_NODE_SCOPE) |
121 | return NULL; | 121 | return NULL; |
@@ -147,7 +147,7 @@ static void named_distribute(struct net *net, struct sk_buff_head *list, | |||
147 | ITEM_SIZE) * ITEM_SIZE; | 147 | ITEM_SIZE) * ITEM_SIZE; |
148 | u32 msg_rem = msg_dsz; | 148 | u32 msg_rem = msg_dsz; |
149 | 149 | ||
150 | list_for_each_entry(publ, pls, local_list) { | 150 | list_for_each_entry(publ, pls, binding_node) { |
151 | /* Prepare next buffer: */ | 151 | /* Prepare next buffer: */ |
152 | if (!skb) { | 152 | if (!skb) { |
153 | skb = named_prepare_buf(net, PUBLICATION, msg_rem, | 153 | skb = named_prepare_buf(net, PUBLICATION, msg_rem, |
@@ -211,7 +211,7 @@ static void tipc_publ_purge(struct net *net, struct publication *publ, u32 addr) | |||
211 | p = tipc_nametbl_remove_publ(net, publ->type, publ->lower, | 211 | p = tipc_nametbl_remove_publ(net, publ->type, publ->lower, |
212 | publ->node, publ->ref, publ->key); | 212 | publ->node, publ->ref, publ->key); |
213 | if (p) | 213 | if (p) |
214 | tipc_node_unsubscribe(net, &p->nodesub_list, addr); | 214 | tipc_node_unsubscribe(net, &p->binding_node, addr); |
215 | spin_unlock_bh(&tn->nametbl_lock); | 215 | spin_unlock_bh(&tn->nametbl_lock); |
216 | 216 | ||
217 | if (p != publ) { | 217 | if (p != publ) { |
@@ -246,7 +246,7 @@ void tipc_publ_notify(struct net *net, struct list_head *nsub_list, u32 addr) | |||
246 | { | 246 | { |
247 | struct publication *publ, *tmp; | 247 | struct publication *publ, *tmp; |
248 | 248 | ||
249 | list_for_each_entry_safe(publ, tmp, nsub_list, nodesub_list) | 249 | list_for_each_entry_safe(publ, tmp, nsub_list, binding_node) |
250 | tipc_publ_purge(net, publ, addr); | 250 | tipc_publ_purge(net, publ, addr); |
251 | tipc_dist_queue_purge(net, addr); | 251 | tipc_dist_queue_purge(net, addr); |
252 | } | 252 | } |
@@ -270,7 +270,7 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i, | |||
270 | TIPC_CLUSTER_SCOPE, node, | 270 | TIPC_CLUSTER_SCOPE, node, |
271 | ntohl(i->ref), ntohl(i->key)); | 271 | ntohl(i->ref), ntohl(i->key)); |
272 | if (publ) { | 272 | if (publ) { |
273 | tipc_node_subscribe(net, &publ->nodesub_list, node); | 273 | tipc_node_subscribe(net, &publ->binding_node, node); |
274 | return true; | 274 | return true; |
275 | } | 275 | } |
276 | } else if (dtype == WITHDRAWAL) { | 276 | } else if (dtype == WITHDRAWAL) { |
@@ -279,7 +279,7 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i, | |||
279 | node, ntohl(i->ref), | 279 | node, ntohl(i->ref), |
280 | ntohl(i->key)); | 280 | ntohl(i->key)); |
281 | if (publ) { | 281 | if (publ) { |
282 | tipc_node_unsubscribe(net, &publ->nodesub_list, node); | 282 | tipc_node_unsubscribe(net, &publ->binding_node, node); |
283 | kfree_rcu(publ, rcu); | 283 | kfree_rcu(publ, rcu); |
284 | return true; | 284 | return true; |
285 | } | 285 | } |
@@ -385,9 +385,9 @@ void tipc_named_reinit(struct net *net) | |||
385 | 385 | ||
386 | spin_lock_bh(&tn->nametbl_lock); | 386 | spin_lock_bh(&tn->nametbl_lock); |
387 | 387 | ||
388 | list_for_each_entry_rcu(publ, &nt->node_scope, local_list) | 388 | list_for_each_entry_rcu(publ, &nt->node_scope, binding_node) |
389 | publ->node = tn->own_addr; | 389 | publ->node = tn->own_addr; |
390 | list_for_each_entry_rcu(publ, &nt->cluster_scope, local_list) | 390 | list_for_each_entry_rcu(publ, &nt->cluster_scope, binding_node) |
391 | publ->node = tn->own_addr; | 391 | publ->node = tn->own_addr; |
392 | 392 | ||
393 | spin_unlock_bh(&tn->nametbl_lock); | 393 | spin_unlock_bh(&tn->nametbl_lock); |
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h index a9063e25ee74..cb16bd883565 100644 --- a/net/tipc/name_table.h +++ b/net/tipc/name_table.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * net/tipc/name_table.h: Include file for TIPC name table code | 2 | * net/tipc/name_table.h: Include file for TIPC name table code |
3 | * | 3 | * |
4 | * Copyright (c) 2000-2006, 2014-2015, Ericsson AB | 4 | * Copyright (c) 2000-2006, 2014-2018, Ericsson AB |
5 | * Copyright (c) 2004-2005, 2010-2011, Wind River Systems | 5 | * Copyright (c) 2004-2005, 2010-2011, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
@@ -76,8 +76,7 @@ struct publication { | |||
76 | u32 node; | 76 | u32 node; |
77 | u32 ref; | 77 | u32 ref; |
78 | u32 key; | 78 | u32 key; |
79 | struct list_head nodesub_list; | 79 | struct list_head binding_node; |
80 | struct list_head local_list; | ||
81 | struct list_head pport_list; | 80 | struct list_head pport_list; |
82 | struct list_head node_list; | 81 | struct list_head node_list; |
83 | struct list_head cluster_list; | 82 | struct list_head cluster_list; |