[sheepdog] [PATCH v2 1/2] sheep: don't send vdi_inuse in get_vdis

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Fri Aug 24 08:09:55 CEST 2012


At Fri, 24 Aug 2012 13:36:46 +0800,
levin li wrote:
> 
> From: levin li <xingke.lwp at taobao.com>
> 
> Since we already send vdi copy list in get_vdis(), there's no
> need to send the vdi_inuse bitmap any more, without it we can
> send less data as the length of vdi copy list is variable and
> it contains the vid just as vdi_inuse does.
> 
> Signed-off-by: levin li <xingke.lwp at taobao.com>
> ---
>  include/internal_proto.h |    1 +
>  sheep/group.c            |   37 ++++++++++++++++---------------------
>  sheep/ops.c              |   15 +++++++++++++++
>  sheep/sheep_priv.h       |    1 +
>  sheep/vdi.c              |    2 +-
>  5 files changed, 34 insertions(+), 22 deletions(-)
> 
> diff --git a/include/internal_proto.h b/include/internal_proto.h
> index 83d98f1..4fe98e5 100644
> --- a/include/internal_proto.h
> +++ b/include/internal_proto.h
> @@ -63,6 +63,7 @@
>  #define SD_OP_ENABLE_RECOVER 0xA8
>  #define SD_OP_DISABLE_RECOVER 0xA9
>  #define SD_OP_INFO_RECOVER 0xAA
> +#define SD_OP_GET_VDI_LIST 0xAB

Is SD_OP_GET_VDI_COPIES better to distinguish it from SD_OP_READ_VDIS
explicitly?

>  
>  /* internal flags for hdr.flags, must be above 0x80 */
>  #define SD_FLAG_CMD_RECOVERY 0x0080
> diff --git a/sheep/group.c b/sheep/group.c
> index bcbd152..5e56d1b 100644
> --- a/sheep/group.c
> +++ b/sheep/group.c
> @@ -618,21 +618,12 @@ static int get_vdis_from(struct sd_node *node)
>  {
>  	struct sd_req hdr;
>  	struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
> -	struct vdi_copy *vc;
> -	static DECLARE_BITMAP(tmp_vdi_inuse, SD_NR_VDIS);
> +	struct vdi_copy *vc = NULL;
>  	int fd, i, ret = SD_RES_SUCCESS;
> -	unsigned int rlen = SD_NR_VDIS * 3, wlen;
> +	unsigned int rlen = SD_NR_VDIS, wlen;

rlen = SD_NR_VDIS * sizeof(*vc)

In addition, I think we don't need to call fill_vdi_copy_list in
read_vdis any more.

Thanks,

Kazutaka



More information about the sheepdog mailing list