diff options
Diffstat (limited to 'net/tipc')
| -rw-r--r-- | net/tipc/name_distr.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index d57da6159616..870a001131c6 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
| @@ -68,12 +68,19 @@ struct distr_item { | |||
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | /** | 70 | /** |
| 71 | * List of externally visible publications by this node -- | 71 | * struct publ_list - list of publications made by this node |
| 72 | * that is, all publications having scope > TIPC_NODE_SCOPE. | 72 | * @list: circular list of publications |
| 73 | * @list_size: number of entries in list | ||
| 73 | */ | 74 | */ |
| 75 | struct publ_list { | ||
| 76 | struct list_head list; | ||
| 77 | u32 size; | ||
| 78 | }; | ||
| 74 | 79 | ||
| 75 | static LIST_HEAD(publ_root); | 80 | static struct publ_list publ_cluster = { |
| 76 | static u32 publ_cnt; | 81 | .list = LIST_HEAD_INIT(publ_cluster.list), |
| 82 | .size = 0, | ||
| 83 | }; | ||
| 77 | 84 | ||
| 78 | /** | 85 | /** |
| 79 | * publ_to_item - add publication info to a publication message | 86 | * publ_to_item - add publication info to a publication message |
| @@ -132,8 +139,8 @@ void tipc_named_publish(struct publication *publ) | |||
| 132 | struct sk_buff *buf; | 139 | struct sk_buff *buf; |
| 133 | struct distr_item *item; | 140 | struct distr_item *item; |
| 134 | 141 | ||
| 135 | list_add_tail(&publ->local_list, &publ_root); | 142 | list_add_tail(&publ->local_list, &publ_cluster.list); |
| 136 | publ_cnt++; | 143 | publ_cluster.size++; |
| 137 | 144 | ||
| 138 | buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); | 145 | buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); |
| 139 | if (!buf) { | 146 | if (!buf) { |
| @@ -156,7 +163,7 @@ void tipc_named_withdraw(struct publication *publ) | |||
| 156 | struct distr_item *item; | 163 | struct distr_item *item; |
| 157 | 164 | ||
| 158 | list_del(&publ->local_list); | 165 | list_del(&publ->local_list); |
| 159 | publ_cnt--; | 166 | publ_cluster.size--; |
| 160 | 167 | ||
| 161 | buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0); | 168 | buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0); |
| 162 | if (!buf) { | 169 | if (!buf) { |
| @@ -207,9 +214,9 @@ void tipc_named_node_up(unsigned long nodearg) | |||
| 207 | INIT_LIST_HEAD(&message_list); | 214 | INIT_LIST_HEAD(&message_list); |
| 208 | 215 | ||
| 209 | read_lock_bh(&tipc_nametbl_lock); | 216 | read_lock_bh(&tipc_nametbl_lock); |
| 210 | rest = publ_cnt * ITEM_SIZE; | 217 | rest = publ_cluster.size * ITEM_SIZE; |
| 211 | 218 | ||
| 212 | list_for_each_entry(publ, &publ_root, local_list) { | 219 | list_for_each_entry(publ, &publ_cluster.list, local_list) { |
| 213 | if (!buf) { | 220 | if (!buf) { |
| 214 | left = (rest <= max_item_buf) ? rest : max_item_buf; | 221 | left = (rest <= max_item_buf) ? rest : max_item_buf; |
| 215 | rest -= left; | 222 | rest -= left; |
| @@ -329,7 +336,7 @@ void tipc_named_reinit(void) | |||
| 329 | 336 | ||
| 330 | write_lock_bh(&tipc_nametbl_lock); | 337 | write_lock_bh(&tipc_nametbl_lock); |
| 331 | 338 | ||
| 332 | list_for_each_entry(publ, &publ_root, local_list) | 339 | list_for_each_entry(publ, &publ_cluster.list, local_list) |
| 333 | publ->node = tipc_own_addr; | 340 | publ->node = tipc_own_addr; |
| 334 | 341 | ||
| 335 | write_unlock_bh(&tipc_nametbl_lock); | 342 | write_unlock_bh(&tipc_nametbl_lock); |
