[sheepdog] [PATCH] object list cache: reset all the necessary data in objlist_cache_format

Meng Lingkun starmlk at 163.com
Wed Jul 15 13:29:02 CEST 2015


From: Meng Lingkun <menglingkun at cmss.chinamobile.com>

The commit 7206b7df2dc86363337c2b6bf8823d70565827e8 failed to clean
objlist cache clearly. So fix it.

Signed-off-by: Meng Lingkun <menglingkun at cmss.chinamobile.com>
---
 sheep/object_list_cache.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/sheep/object_list_cache.c b/sheep/object_list_cache.c
index 86642cd..93c11f9 100644
--- a/sheep/object_list_cache.c
+++ b/sheep/object_list_cache.c
@@ -202,5 +202,12 @@ 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);
+	obj_list_cache.tree_version = 1;
+	obj_list_cache.buf_version = 0;
+	if (NULL != obj_list_cache.buf) {
+		free(obj_list_cache.buf);
+		obj_list_cache.buf = NULL;
+	}
+	obj_list_cache.cache_size = 0;
 	sd_rw_unlock(&obj_list_cache.lock);
 }
-- 
1.7.1




More information about the sheepdog mailing list