[CRIU] [PATCH 07/10] deduplication: add punching holes in "parent"

Tikhomirov Pavel snorcht at gmail.com
Tue Nov 19 02:28:26 PST 2013


punch where coresponding data was updated in curent snapshot

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 a8df351..6bc43f0 100644
--- a/cr-dedup.c
+++ b/cr-dedup.c
@@ -1,3 +1,4 @@
+#include <linux/falloc.h>
 #include <unistd.h>
 
 #include "crtools.h"
@@ -101,6 +102,17 @@ int cr_dedup_one_pagemap(int pid)
 		off_real = lseek(prp->fd_pg, 0, SEEK_CUR);
 
 		/*Here to punch that pagemap*/
+		if (!pr.pe->in_parent && !prp->pe->in_parent) {
+			/* punch */
+			pr_info("Punch!/%lu/%lu/\n", off_real, min(piov_end, iov_end) - off);
+
+			ret = fallocate(prp->fd_pg, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
+					off_real, min(piov_end, iov_end) - off);
+			if (ret != 0) {
+				pr_err("Error punching hole : %d\n", errno);
+				goto exit;
+			}
+		}
 
 		if (piov_end < iov_end) {
 			off = piov_end;
-- 
1.7.9.5



More information about the CRIU mailing list