diff options
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/name_distr.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 3be0eb9509df..8751ea53dfde 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
@@ -77,11 +77,29 @@ struct publ_list { | |||
77 | u32 size; | 77 | u32 size; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static struct publ_list publ_zone = { | ||
81 | .list = LIST_HEAD_INIT(publ_zone.list), | ||
82 | .size = 0, | ||
83 | }; | ||
84 | |||
80 | static struct publ_list publ_cluster = { | 85 | static struct publ_list publ_cluster = { |
81 | .list = LIST_HEAD_INIT(publ_cluster.list), | 86 | .list = LIST_HEAD_INIT(publ_cluster.list), |
82 | .size = 0, | 87 | .size = 0, |
83 | }; | 88 | }; |
84 | 89 | ||
90 | static struct publ_list publ_node = { | ||
91 | .list = LIST_HEAD_INIT(publ_node.list), | ||
92 | .size = 0, | ||
93 | }; | ||
94 | |||
95 | static struct publ_list *publ_lists[] = { | ||
96 | NULL, | ||
97 | &publ_zone, /* publ_lists[TIPC_ZONE_SCOPE] */ | ||
98 | &publ_cluster, /* publ_lists[TIPC_CLUSTER_SCOPE] */ | ||
99 | &publ_node /* publ_lists[TIPC_NODE_SCOPE] */ | ||
100 | }; | ||
101 | |||
102 | |||
85 | /** | 103 | /** |
86 | * publ_to_item - add publication info to a publication message | 104 | * publ_to_item - add publication info to a publication message |
87 | */ | 105 | */ |
@@ -139,8 +157,8 @@ void tipc_named_publish(struct publication *publ) | |||
139 | struct sk_buff *buf; | 157 | struct sk_buff *buf; |
140 | struct distr_item *item; | 158 | struct distr_item *item; |
141 | 159 | ||
142 | list_add_tail(&publ->local_list, &publ_cluster.list); | 160 | list_add_tail(&publ->local_list, &publ_lists[publ->scope]->list); |
143 | publ_cluster.size++; | 161 | publ_lists[publ->scope]->size++; |
144 | 162 | ||
145 | buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); | 163 | buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); |
146 | if (!buf) { | 164 | if (!buf) { |
@@ -163,7 +181,7 @@ void tipc_named_withdraw(struct publication *publ) | |||
163 | struct distr_item *item; | 181 | struct distr_item *item; |
164 | 182 | ||
165 | list_del(&publ->local_list); | 183 | list_del(&publ->local_list); |
166 | publ_cluster.size--; | 184 | publ_lists[publ->scope]->size--; |
167 | 185 | ||
168 | buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0); | 186 | buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0); |
169 | if (!buf) { | 187 | if (!buf) { |
@@ -243,6 +261,7 @@ void tipc_named_node_up(unsigned long nodearg) | |||
243 | 261 | ||
244 | read_lock_bh(&tipc_nametbl_lock); | 262 | read_lock_bh(&tipc_nametbl_lock); |
245 | named_distribute(&message_list, node, &publ_cluster, max_item_buf); | 263 | named_distribute(&message_list, node, &publ_cluster, max_item_buf); |
264 | named_distribute(&message_list, node, &publ_zone, max_item_buf); | ||
246 | read_unlock_bh(&tipc_nametbl_lock); | 265 | read_unlock_bh(&tipc_nametbl_lock); |
247 | 266 | ||
248 | tipc_link_send_names(&message_list, (u32)node); | 267 | tipc_link_send_names(&message_list, (u32)node); |
@@ -340,11 +359,13 @@ void tipc_named_recv(struct sk_buff *buf) | |||
340 | void tipc_named_reinit(void) | 359 | void tipc_named_reinit(void) |
341 | { | 360 | { |
342 | struct publication *publ; | 361 | struct publication *publ; |
362 | int scope; | ||
343 | 363 | ||
344 | write_lock_bh(&tipc_nametbl_lock); | 364 | write_lock_bh(&tipc_nametbl_lock); |
345 | 365 | ||
346 | list_for_each_entry(publ, &publ_cluster.list, local_list) | 366 | for (scope = TIPC_ZONE_SCOPE; scope <= TIPC_CLUSTER_SCOPE; scope++) |
347 | publ->node = tipc_own_addr; | 367 | list_for_each_entry(publ, &publ_lists[scope]->list, local_list) |
368 | publ->node = tipc_own_addr; | ||
348 | 369 | ||
349 | write_unlock_bh(&tipc_nametbl_lock); | 370 | write_unlock_bh(&tipc_nametbl_lock); |
350 | } | 371 | } |