[Sheepdog] [PATCH v2] sheep: need not read many copies of bitmap

Liu Yuan namei.unix at gmail.com
Fri May 11 04:59:18 CEST 2012


On 05/10/2012 05:17 PM, yaohaiting.wujue at gmail.com wrote:

> From: HaiTing Yao <wujue.yht at taobao.com>
> 
> Node maybe need read all of the bitmaps when the epoch is not zero. This
> perhaps occurs when we restart the shutdown cluster or join one once
> existed node.
> 
> Usually, node need not read many copies of bitmap. If the cluster status
> is OK and the node status is waiting for format, node just need read one
> bitamp.
> 
> Signed-off-by: HaiTing Yao <wujue.yht at taobao.com>
> ---
>  sheep/group.c |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
> 
> changes from v1
> Sometimes node only need read one copy of bitmap, and sometimes it
> need read all of copies of bitmap. I added some comments to make it
> more clear. 
> 
> diff --git a/sheep/group.c b/sheep/group.c
> index c7fd387..d7ceae7 100644
> --- a/sheep/group.c
> +++ b/sheep/group.c
> @@ -720,9 +720,17 @@ static void __sd_join(struct event_struct *cevent)
>  	if (sys_stat_ok())
>  		return;
>  
> -	get_vdi_bitmap_from_sd_list();
> -	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())
> +		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);
> +	}
>  }
>  
>  static void __sd_leave(struct event_struct *cevent)


Applied. thanks.

Yuan



More information about the sheepdog mailing list