Commit a02794b7 authored by Tikhomirov Pavel's avatar Tikhomirov Pavel Committed by Pavel Emelyanov

deduplication: make it recursively deduplicate all parent snapshots

If we write a page into image and punch it from parnet, checking
only one level down is not enough -- the iovec can reside deeper.

That said, make the hole punching be recursive.
Signed-off-by: 's avatarTikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 004f1f5b
......@@ -113,6 +113,9 @@ 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)
return -1;
......@@ -138,6 +141,16 @@ int dedup_one_iovec(struct page_read *pr, struct iovec *iov)
return -1;
}
}
prp = pr->parent;
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment