[CRIU] [PATCH 1/3] deduplication: make it recursively deduplicate all parent snapshots
Pavel Emelyanov
xemul at parallels.com
Mon Jan 20 05:29:00 PST 2014
On 01/20/2014 05:21 PM, Tikhomirov Pavel wrote:
>
> 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 d407974..8ba9c70 100644
> --- a/cr-dedup.c
> +++ b/cr-dedup.c
> @@ -113,6 +113,8 @@ int dedup_one_iovec(struct page_read *pr, struct iovec *iov)
> int ret;
> struct iovec piov;
> unsigned long piov_end;
> + struct iovec tiov;
> + struct page_read * prp;
> ret = seek_pagemap_page(pr, off, false);
> if (ret == -1) {
> if (off < pr->cvaddr) {
> @@ -138,6 +140,16 @@ int dedup_one_iovec(struct page_read *pr, struct iovec *iov)
> return -1;
> }
> }
> + prp = pr->parent;
Is this parent already open-ed? On dump we open only one level of images.
And I think this branch should run only if we haven't found what to dedup
on existing level (i.e. in_parent == True).
> + if (prp) {
> + /* recursively */
> + pr_debug("Go to next parent level");
> + tiov.iov_base = (void*)off;
> + tiov.iov_len = min(piov_end, iov_end) - off;
> + ret = dedup_one_iovec(prp, &tiov);
> + if (ret != 0)
> + return -1;
> + }
>
> if (piov_end < iov_end) {
> off = piov_end;
>
More information about the CRIU
mailing list