[sheepdog] [PATCH] object list cache: cleanup object list cache when format cluster
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Mon May 18 06:46:03 CEST 2015
At Mon, 18 May 2015 09:47:59 +0800,
Meng Lingkun wrote:
>
> Cleanup the object list cache when format cluster to keep data
> consistency.
>
> Signed-off-by: Meng Lingkun <menglingkun at cmss.chinamobile.com>
> ---
> sheep/object_list_cache.c | 8 ++++++++
> sheep/ops.c | 1 +
> sheep/sheep_priv.h | 1 +
> 3 files changed, 10 insertions(+), 0 deletions(-)
Applied, thanks.
Hitoshi
>
> diff --git a/sheep/object_list_cache.c b/sheep/object_list_cache.c
> index b9acaa0..86642cd 100644
> --- a/sheep/object_list_cache.c
> +++ b/sheep/object_list_cache.c
> @@ -196,3 +196,11 @@ int objlist_cache_cleanup(uint32_t vid)
>
> return SD_RES_SUCCESS;
> }
> +
> +void objlist_cache_format(void)
> +{
> + sd_write_lock(&obj_list_cache.lock);
> + rb_destroy(&obj_list_cache.root, struct objlist_cache_entry, node);
> + INIT_RB_ROOT(&obj_list_cache.root);
> + sd_rw_unlock(&obj_list_cache.lock);
> +}
> diff --git a/sheep/ops.c b/sheep/ops.c
> index c6065d5..7b92f8c 100644
> --- a/sheep/ops.c
> +++ b/sheep/ops.c
> @@ -342,6 +342,7 @@ static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp,
> memset(sys->vdi_inuse, 0, sizeof(sys->vdi_inuse));
> memset(sys->vdi_deleted, 0, sizeof(sys->vdi_deleted));
> clean_vdi_state();
> + objlist_cache_format();
>
> sys->cinfo.epoch = 0;
>
> diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
> index 589f327..7becf6e 100644
> --- a/sheep/sheep_priv.h
> +++ b/sheep/sheep_priv.h
> @@ -453,6 +453,7 @@ void init_config_path(const char *base_path);
> int init_config_file(void);
> int get_obj_list(const struct sd_req *, struct sd_rsp *, void *);
> int objlist_cache_cleanup(uint32_t vid);
> +void objlist_cache_format(void);
>
> int start_recovery(struct vnode_info *cur_vinfo, struct vnode_info *, bool);
> bool oid_in_recovery(uint64_t oid);
> --
> 1.7.1
>
>
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog
More information about the sheepdog
mailing list