[CRIU] [PATCH 1/3] deduplication: make it recursively deduplicate all parent snapshots

Tikhomirov Pavel snorcht at gmail.com
Mon Jan 20 05:21:56 PST 2014


Signed-off-by: Tikhomirov Pavel <snorcht at gmail.com>
---
 cr-dedup.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/cr-dedup.c b/cr-dedup.c
index d407974..8ba9c70 100644
--- a/cr-dedup.c
+++ b/cr-dedup.c
@@ -113,6 +113,8 @@ int dedup_one_iovec(struct page_read *pr, struct iovec *iov)
 		int ret;
 		struct iovec piov;
 		unsigned long  piov_end;
+		struct iovec tiov;
+		struct page_read * prp;
 		ret = seek_pagemap_page(pr, off, false);
 		if (ret == -1) {
 			if (off < pr->cvaddr) {
@@ -138,6 +140,16 @@ int dedup_one_iovec(struct page_read *pr, struct iovec *iov)
 				return -1;
 			}
 		}
+		prp = pr->parent;
+		if (prp) {
+			/* recursively */
+			pr_debug("Go to next parent level");
+			tiov.iov_base = (void*)off;
+			tiov.iov_len = min(piov_end, iov_end) - off;
+			ret = dedup_one_iovec(prp, &tiov);
+			if (ret != 0)
+				return -1;
+		}
 
 		if (piov_end < iov_end) {
 			off = piov_end;
-- 
1.7.9.5



More information about the CRIU mailing list