[sheepdog] [PATCH] object list cache: cleanup object list cache when format cluster
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Mon May 18 02:23:47 CEST 2015
At Fri, 15 May 2015 12:56:43 +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 +
> 2 files changed, 9 insertions(+), 0 deletions(-)
>
> 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);
> +}
You need to add a declaration of the above function to sheep_priv.h.
Thanks,
Hitoshi
> 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;
>
> --
> 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