[sheepdog] [PATCH] cache: reclaim cow objects after sheep restart

Liu Yuan namei.unix at gmail.com
Fri Jul 19 04:34:23 CEST 2013


Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/object_cache.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sheep/object_cache.c b/sheep/object_cache.c
index 2b2f7c0..1bd2a59 100644
--- a/sheep/object_cache.c
+++ b/sheep/object_cache.c
@@ -547,7 +547,14 @@ static void do_reclaim_object(struct object_cache *oc)
 			sd_dprintf("%"PRIx64" is in use, skip...", oid);
 			continue;
 		}
-		if (entry_is_dirty(entry)) {
+
+		/*
+		 * The shared snapshot objects won't be released after being
+		 * pulled and if sheep restarts, the remaining snapshot objects
+		 * will be marked as dirty. So for these kind of objects, we
+		 * can reclaim them safely.
+		 */
+		if (entry_is_dirty(entry) && !oid_is_readonly(oid)) {
 			sd_dprintf("%"PRIx64" is dirty, skip...", oid);
 			continue;
 		}
-- 
1.7.9.5




More information about the sheepdog mailing list