[sheepdog] [PATCH v2 6/7] dog: add a new subcommand "dog vdi lock list" for listing vdi locking status

Liu Yuan namei.unix at gmail.com
Wed Jul 30 11:44:44 CEST 2014


On Wed, Jul 30, 2014 at 04:24:41PM +0900, Hitoshi Mitake wrote:
> This patch adds a new subcommand "dog vdi lock list". It can be used
> for detecting which nodes are locking VDIs.
> 
> Cc: Fabian Zimmermann <dev.faz at gmail.com>
> Cc: Valerio Pachera <sirio81 at gmail.com>
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
>  dog/treeview.c           | 41 +++++++++++++++++++++++++++++
>  dog/treeview.h           |  2 ++
>  dog/vdi.c                | 67 ++++++++++++++++++++++++++++++++++++++++++++++++
>  include/internal_proto.h | 16 ++++++++++++
>  sheep/sheep_priv.h       |  9 -------
>  sheep/vdi.c              |  6 -----
>  6 files changed, 126 insertions(+), 15 deletions(-)
> 
> diff --git a/dog/treeview.c b/dog/treeview.c
> index e3b75f4..84cfae6 100644
> --- a/dog/treeview.c
> +++ b/dog/treeview.c
> @@ -39,6 +39,37 @@ static struct vdi_tree *find_vdi(struct vdi_tree *parent, uint32_t vid,
>  	return NULL;
>  }
>  
> +static struct vdi_tree *find_vdi_with_vid(struct vdi_tree *parent, uint32_t vid)

find_vdi_by_vdi looks better.

> +{
> +	struct vdi_tree *vdi, *ret;
> +
> +	list_for_each_entry(vdi, &parent->children, siblings) {
> +		if (vdi->vid == vid)
> +			return vdi;
> +
> +		ret = find_vdi_with_vid(vdi, vid);
> +		if (ret)
> +			return ret;
> +	}
> +	return NULL;
> +}
> +
> +static struct vdi_tree *find_vdi_with_name(struct vdi_tree *parent,
> +					   const char *name)

ditto.

Thanks
Yuan



More information about the sheepdog mailing list