2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 05:18:00 +00:00

pagemap: Remove seek_pagemap_page

The page_read.seek_pagemap already tunes the pages offset,
so the separate call for skip_pagemap_pages in the routine
in question is always no-op.

Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Pavel Emelyanov 2017-07-06 12:39:16 +03:00 committed by Andrei Vagin
parent a33b747f7d
commit f9510f67e9
2 changed files with 4 additions and 18 deletions

View File

@ -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;

View File

@ -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;
}