diff --git a/criu/pagemap.c b/criu/pagemap.c index ef13220e7..e30d9e08d 100644 --- a/criu/pagemap.c +++ b/criu/pagemap.c @@ -74,8 +74,6 @@ static int punch_hole(struct page_read *pr, unsigned long off, return 0; } -static int seek_pagemap_page(struct page_read *pr, unsigned long vaddr); - int dedup_one_iovec(struct page_read *pr, unsigned long off, unsigned long len) { unsigned long iov_end; @@ -86,7 +84,7 @@ int dedup_one_iovec(struct page_read *pr, unsigned long off, unsigned long len) unsigned long piov_end; struct page_read * prp; - ret = seek_pagemap_page(pr, off); + ret = pr->seek_pagemap(pr, off); if (ret == 0) { pr_warn("Missing %lx in parent pagemap\n", off); if (off < pr->cvaddr && pr->cvaddr < iov_end) @@ -159,7 +157,7 @@ static int seek_pagemap(struct page_read *pr, unsigned long vaddr) break; if (vaddr >= start && vaddr < end) { - skip_pagemap_pages(pr, start - pr->cvaddr); + skip_pagemap_pages(pr, vaddr - pr->cvaddr); return 1; } @@ -172,16 +170,6 @@ adv: return 0; } -static int seek_pagemap_page(struct page_read *pr, unsigned long vaddr) -{ - if (seek_pagemap(pr, vaddr)) { - skip_pagemap_pages(pr, vaddr - pr->cvaddr); - return 1; - } - - return 0; -} - static inline void pagemap_bound_check(PagemapEntry *pe, unsigned long vaddr, int nr) { if (vaddr < pe->vaddr || (vaddr - pe->vaddr) / PAGE_SIZE + nr > pe->nr_pages) { @@ -214,7 +202,7 @@ static int read_parent_page(struct page_read *pr, unsigned long vaddr, int p_nr; pr_debug("\tpr%d-%u Read from parent\n", pr->pid, pr->id); - ret = seek_pagemap_page(ppr, vaddr); + ret = ppr->seek_pagemap(ppr, vaddr); if (ret <= 0) { pr_err("Missing %lx in parent pagemap\n", vaddr); return -1; diff --git a/criu/uffd.c b/criu/uffd.c index 703dc4362..a94eaaa13 100644 --- a/criu/uffd.c +++ b/criu/uffd.c @@ -787,11 +787,9 @@ static int uffd_seek_pages(struct lazy_pages_info *lpi, __u64 address, int nr) ret = lpi->pr.seek_pagemap(&lpi->pr, address); if (!ret) { lp_err(lpi, "no pagemap covers %llx\n", address); - return ret; + return -1; } - lpi->pr.skip_pages(&lpi->pr, address - lpi->pr.pe->vaddr); - return 0; }