[sheepdog] [PATCH 1/3] sheep: delete useless get_vdi_bitmap_from_sd_list()
Liu Yuan
namei.unix at gmail.com
Wed May 16 12:05:40 CEST 2012
On 05/16/2012 05:04 PM, Yunkai Zhang wrote:
> From: Yunkai Zhang <qiushu.zyk at taobao.com>
>
> I have tested this patch with corosync/zookeeper dirver, it works well.
> -------------------------------------------------------------------- >8
>
> In __sd_join(), get_vdi_bitmap_from_sd_list() do a lot of duplicated
> works with following for loop as w->member_list contains all nodes in
> sys->nodes.
>
> So we can drop get_vdi_bitmap_from_sd_list() safely, it can make
> __sd_join() looks more cleanly.
>
> Signed-off-by: Yunkai Zhang <qiushu.zyk at taobao.com>
> ---
> sheep/group.c | 29 ++++++++++-------------------
> 1 files changed, 10 insertions(+), 19 deletions(-)
>
> diff --git a/sheep/group.c b/sheep/group.c
> index 54bd8f3..a5311fc 100644
> --- a/sheep/group.c
> +++ b/sheep/group.c
> @@ -515,15 +515,6 @@ out:
> return ret;
> }
>
> -static void get_vdi_bitmap_from_sd_list(void)
> -{
> - int i;
> - /* fixme: we need this until starting up. */
> -
> - for (i = 0; i < sys->nr_nodes; i++)
> - get_vdi_bitmap_from(sys->nodes + i);
> -}
> -
> static void finish_join(struct join_message *msg, struct sd_node *joined,
> struct sd_node *nodes, size_t nr_nodes)
> {
> @@ -723,16 +714,16 @@ static void __sd_join(struct event_struct *cevent)
> if (sys_stat_ok())
> return;
>
> - /*
> - * If a new comer try to join the running cluster, it only need read
> - * one copy of bitmap from the first member.
> - */
> - if (sys_stat_wait_format())
> - get_vdi_bitmap_from(w->member_list);
> - else {
> - get_vdi_bitmap_from_sd_list();
> - for (i = 0; i < w->member_list_entries; i++)
> - get_vdi_bitmap_from(w->member_list + i);
> + for (i = 0; i < w->member_list_entries; i++) {
> +
> + get_vdi_bitmap_from(w->member_list + i);
> +
> + /*
> + * If a new comer try to join the running cluster, it only
> + * need read one copy of bitmap from the first member.
> + */
> + if (sys_stat_wait_format())
> + break;
> }
> }
>
Applied this one, thanks.
Yuan
More information about the sheepdog
mailing list