[CRIU] [PATCH 3/7] pagemap: seek_pagemap_page: drop warn parameter

Mike Rapoport rppt at linux.vnet.ibm.com
Sun Nov 20 01:50:02 PST 2016


Move error printouts to the call sites to keep "fast path" clearer.

Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 criu/include/pagemap.h |  2 +-
 criu/page-xfer.c       |  6 ++++--
 criu/pagemap.c         | 13 ++++++-------
 criu/uffd.c            |  2 +-
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/criu/include/pagemap.h b/criu/include/pagemap.h
index 50829ae..54c147a 100644
--- a/criu/include/pagemap.h
+++ b/criu/include/pagemap.h
@@ -54,7 +54,7 @@ struct page_read {
 	int (*advance)(struct page_read *pr);
 	void (*close)(struct page_read *);
 	void (*skip_pages)(struct page_read *, unsigned long len);
-	int (*seek_page)(struct page_read *pr, unsigned long vaddr, bool warn);
+	int (*seek_page)(struct page_read *pr, unsigned long vaddr);
 	void (*reset)(struct page_read *pr);
 	int (*sync)(struct page_read *pr);
 
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
index 234c38d..f308972 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -208,9 +208,11 @@ static int check_pagehole_in_parent(struct page_read *p, struct iovec *iov)
 		struct iovec piov;
 		unsigned long pend;
 
-		ret = p->seek_page(p, off, true);
-		if (ret <= 0 || !p->pe)
+		ret = p->seek_page(p, off);
+		if (ret <= 0 || !p->pe) {
+			pr_err("Missing %lx in parent pagemap\n", off);
 			return -1;
+		}
 
 		pagemap2iovec(p->pe, &piov);
 		pr_debug("\tFound %p/%zu\n", piov.iov_base, piov.iov_len);
diff --git a/criu/pagemap.c b/criu/pagemap.c
index dda0ebe..3c2fc5c 100644
--- a/criu/pagemap.c
+++ b/criu/pagemap.c
@@ -97,7 +97,7 @@ int dedup_one_iovec(struct page_read *pr, struct iovec *iov)
 		struct iovec tiov;
 		struct page_read * prp;
 
-		ret = pr->seek_page(pr, off, false);
+		ret = pr->seek_page(pr, off);
 		if (ret == 0) {
 			pr_err("Missing %lx in parent pagemap\n", off);
 			if (off < pr->cvaddr && pr->cvaddr < iov_end)
@@ -177,8 +177,7 @@ static void skip_pagemap_pages(struct page_read *pr, unsigned long len)
 	pr->cvaddr += len;
 }
 
-static int seek_pagemap_page(struct page_read *pr, unsigned long vaddr,
-			     bool warn)
+static int seek_pagemap_page(struct page_read *pr, unsigned long vaddr)
 {
 	if (!pr->pe)
 		advance(pr);
@@ -203,8 +202,6 @@ static int seek_pagemap_page(struct page_read *pr, unsigned long vaddr,
 			skip_pagemap_pages(pr, end - pr->cvaddr);
 	} while (advance(pr));
 
-	if (warn)
-		pr_err("Missing %lx in parent pagemap\n", vaddr);
 	return 0;
 }
 
@@ -235,9 +232,11 @@ static int read_parent_page(struct page_read *pr, unsigned long vaddr,
 		int p_nr;
 
 		pr_debug("\tpr%u Read from parent\n", pr->id);
-		ret = seek_pagemap_page(ppr, vaddr, true);
-		if (ret <= 0)
+		ret = seek_pagemap_page(ppr, vaddr);
+		if (ret <= 0) {
+			pr_err("Missing %lx in parent pagemap\n", vaddr);
 			return -1;
+		}
 
 		/*
 		 * This is how many pages we have in the parent
diff --git a/criu/uffd.c b/criu/uffd.c
index 76028ea..71fed07 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -622,7 +622,7 @@ static int uffd_seek_or_zero_pages(struct lazy_pages_info *lpi, __u64 address,
 	 * FIXME: rework zeroes handling so we won't need to rely on
 	 * seek_page return value here
 	 */
-	ret = lpi->pr.seek_page(&lpi->pr, address, false);
+	ret = lpi->pr.seek_page(&lpi->pr, address);
 	if (ret == 0 || pagemap_zero(lpi->pr.pe))
 		return uffd_zero(lpi, address, nr);
 
-- 
1.9.1



More information about the CRIU mailing list