diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2012-04-17 17:57:52 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-04-18 09:36:02 -0400 |
commit | 3f8375fee30cbf7fb0bd67f044e3406daa16fa3e (patch) | |
tree | 677453d1143554978ce527483a468f5098f8a9ab /net/tipc | |
parent | 798ec84d45754403571d6387396236e877965c5a (diff) | |
download | linux-3.10-3f8375fee30cbf7fb0bd67f044e3406daa16fa3e.tar.gz linux-3.10-3f8375fee30cbf7fb0bd67f044e3406daa16fa3e.tar.bz2 linux-3.10-3f8375fee30cbf7fb0bd67f044e3406daa16fa3e.zip |
tipc: introduce publication lists struct
There is currently a single list that is containing both cluster-scope and
zone-scope publications, and the list count is a separate free floating
variable. Create a struct to bind the count to the list, and to pave
the way for factoring out the publications into zone/cluster/node scope.
The current "publ_root" most matches what will be the cluster scope
list, so it is named accordingly in this commit.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
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 d57da615961..870a001131c 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c @@ -68,12 +68,19 @@ struct distr_item { }; /** - * List of externally visible publications by this node -- - * that is, all publications having scope > TIPC_NODE_SCOPE. + * struct publ_list - list of publications made by this node + * @list: circular list of publications + * @list_size: number of entries in list */ +struct publ_list { + struct list_head list; + u32 size; +}; -static LIST_HEAD(publ_root); -static u32 publ_cnt; +static struct publ_list publ_cluster = { + .list = LIST_HEAD_INIT(publ_cluster.list), + .size = 0, +}; /** * publ_to_item - add publication info to a publication message @@ -132,8 +139,8 @@ void tipc_named_publish(struct publication *publ) struct sk_buff *buf; struct distr_item *item; - list_add_tail(&publ->local_list, &publ_root); - publ_cnt++; + list_add_tail(&publ->local_list, &publ_cluster.list); + publ_cluster.size++; buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); if (!buf) { @@ -156,7 +163,7 @@ void tipc_named_withdraw(struct publication *publ) struct distr_item *item; list_del(&publ->local_list); - publ_cnt--; + publ_cluster.size--; buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0); if (!buf) { @@ -207,9 +214,9 @@ void tipc_named_node_up(unsigned long nodearg) INIT_LIST_HEAD(&message_list); read_lock_bh(&tipc_nametbl_lock); - rest = publ_cnt * ITEM_SIZE; + rest = publ_cluster.size * ITEM_SIZE; - list_for_each_entry(publ, &publ_root, local_list) { + list_for_each_entry(publ, &publ_cluster.list, local_list) { if (!buf) { left = (rest <= max_item_buf) ? rest : max_item_buf; rest -= left; @@ -329,7 +336,7 @@ void tipc_named_reinit(void) write_lock_bh(&tipc_nametbl_lock); - list_for_each_entry(publ, &publ_root, local_list) + list_for_each_entry(publ, &publ_cluster.list, local_list) publ->node = tipc_own_addr; write_unlock_bh(&tipc_nametbl_lock); |