[CRIU] [PATCH v6 3/9] Revert "criu: page-{pipe, xfer}: add helper function for dumping holes"
Mike Rapoport
rppt at linux.vnet.ibm.com
Thu Jul 14 05:49:30 PDT 2016
This reverts commit 9ccf62388d30e9e0d000f4b026d2755ae79241d3.
Conflicts:
criu/page-xfer.c
---
criu/include/page-pipe.h | 1 -
criu/page-pipe.c | 2 --
criu/page-xfer.c | 42 +++++++++++++++++++-----------------------
3 files changed, 19 insertions(+), 26 deletions(-)
diff --git a/criu/include/page-pipe.h b/criu/include/page-pipe.h
index dae242a..0a0c2e3 100644
--- a/criu/include/page-pipe.h
+++ b/criu/include/page-pipe.h
@@ -83,7 +83,6 @@ struct page_pipe_buf {
struct page_pipe_iovs {
unsigned int nr_iovs; /* number of iovs */
unsigned int free_iov; /* number of iovs in use */
- unsigned int busy_iov; /* first iov that not yet dumped */
struct iovec *iovs; /* iovs */
};
diff --git a/criu/page-pipe.c b/criu/page-pipe.c
index 82abc92..91ae0c8 100644
--- a/criu/page-pipe.c
+++ b/criu/page-pipe.c
@@ -162,12 +162,10 @@ struct page_pipe *create_page_pipe(unsigned int nr_segs, struct iovec *iovs, uns
pp->pages.nr_iovs = nr_segs;
pp->pages.iovs = iovs;
pp->pages.free_iov = 0;
- pp->pages.busy_iov = 0;
pp->holes.nr_iovs = 0;
pp->holes.free_iov = 0;
pp->holes.iovs = NULL;
- pp->holes.busy_iov = 0;
if (page_pipe_grow(pp, 0))
goto err_free_iovs;
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
index a3e3a7c..ed559f3 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -349,29 +349,12 @@ static struct iovec get_iov(struct iovec *iovs, unsigned int n, bool compat)
}
}
-static int dump_hole(struct page_xfer *xfer, struct page_pipe_iovs *iov,
- void *limit, unsigned long off, bool compat)
-{
- int ret;
- unsigned int cur_hole;
-
- for (cur_hole = iov->busy_iov; cur_hole < iov->free_iov; cur_hole++) {
- struct iovec hole = get_iov(iov->iovs, cur_hole, compat);
-
- if (hole.iov_base >= limit)
- break;
- ret = page_xfer_dump_hole(xfer, &hole, off);
- if (ret)
- return ret;
- }
-
- return 0;
-}
-
int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
unsigned long off)
{
struct page_pipe_buf *ppb;
+ unsigned int cur_hole = 0;
+ int ret;
pr_debug("Transfering pages:\n");
@@ -383,8 +366,16 @@ int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
for (i = 0; i < ppb->nr_segs; i++) {
struct iovec iov = get_iov(ppb->iov, i, pp->flags & PP_COMPAT);
- if (dump_hole(xfer, &pp->holes, iov.iov_base, off, pp->flags & PP_COMPAT))
- return -1;
+ for (; cur_hole < pp->holes.free_iov ; cur_hole++) {
+ struct iovec hole = get_iov(pp->holes.iovs, cur_hole,
+ pp->flags & PP_COMPAT);
+
+ if (hole.iov_base >= iov.iov_base)
+ break;
+ ret = page_xfer_dump_hole(xfer, &hole, off);
+ if (ret)
+ return ret;
+ }
BUG_ON(iov.iov_base < (void *)off);
iov.iov_base -= off;
@@ -398,8 +389,13 @@ int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
}
}
- if (dump_hole(xfer, &pp->holes, NULL, off, pp->flags & PP_COMPAT))
- return -1;
+ for (; cur_hole < pp->holes.free_iov ; cur_hole++) {
+ struct iovec hole = get_iov(pp->holes.iovs, cur_hole, pp->flags & PP_COMPAT);
+
+ ret = page_xfer_dump_hole(xfer, &hole, off);
+ if (ret)
+ return ret;
+ }
return 0;
}
--
1.9.1
More information about the CRIU
mailing list