diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2023-12-28 10:14:18 +0100 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2024-01-20 16:06:54 +0100 |
commit | 7677d4b1b52ab68484545d0fcd7348f2f8e9f263 (patch) | |
tree | f4712150c93871ce088954f7c752aac78cd83fc4 /src/librbd/api/DiffIterate.cc | |
parent | librbd/object_map: add support for ranged diff-iterate (diff) | |
download | ceph-7677d4b1b52ab68484545d0fcd7348f2f8e9f263.tar.xz ceph-7677d4b1b52ab68484545d0fcd7348f2f8e9f263.zip |
librbd: propagate diff-iterate range to parent in fast-diff mode
When getting parent diff, pass the overlap-reduced image extent instead
of the entire 0..overlap range to avoid a similar quadratic slowdown on
cloned images.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to '')
-rw-r--r-- | src/librbd/api/DiffIterate.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/librbd/api/DiffIterate.cc b/src/librbd/api/DiffIterate.cc index a464b942ae0..b114c32faba 100644 --- a/src/librbd/api/DiffIterate.cc +++ b/src/librbd/api/DiffIterate.cc @@ -293,12 +293,14 @@ int DiffIterate<I>::execute() { std::shared_lock image_locker{m_image_ctx.image_lock}; uint64_t raw_overlap = 0; m_image_ctx.get_parent_overlap(m_image_ctx.snap_id, &raw_overlap); - auto overlap = m_image_ctx.reduce_parent_overlap(raw_overlap, false); - if (overlap.first > 0 && overlap.second == io::ImageArea::DATA) { + io::Extents parent_extents = {{m_offset, m_length}}; + if (m_image_ctx.prune_parent_extents(parent_extents, io::ImageArea::DATA, + raw_overlap, false) > 0) { ldout(cct, 10) << " first getting parent diff" << dendl; - DiffIterate diff_parent(*m_image_ctx.parent, {}, nullptr, 0, - overlap.first, true, true, &simple_diff_cb, - &parent_diff); + DiffIterate diff_parent(*m_image_ctx.parent, {}, nullptr, + parent_extents[0].first, + parent_extents[0].second, true, true, + &simple_diff_cb, &parent_diff); r = diff_parent.execute(); if (r < 0) { return r; |