mirror of
https://github.com/ceph/ceph
synced 2025-02-25 12:03:00 +00:00
librados: fix calc_snap_set_diff interval calculation
When calculating the [a,b] interval over which a given clone is valid, do not assume that b == the clone id; that is *not* true when the original end snap has been deleted/trimmed. While we are here, make the code a bit cleaner to read. Fixes: #4785 Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
parent
5668e5b5a4
commit
3604c98232
@ -32,13 +32,14 @@ void calc_snap_set_diff(CephContext *cct, const librados::snap_set_t& snap_set,
|
||||
// make an interval, and hide the fact that the HEAD doesn't
|
||||
// include itself in the snaps list
|
||||
librados::snap_t a, b;
|
||||
b = r->cloneid;
|
||||
if (b == librados::SNAP_HEAD) {
|
||||
if (r->cloneid == librados::SNAP_HEAD) {
|
||||
// head is valid starting from right after the last seen seq
|
||||
a = snap_set.seq + 1;
|
||||
b = librados::SNAP_HEAD;
|
||||
} else {
|
||||
assert(b == r->snaps[r->snaps.size()-1]);
|
||||
a = r->snaps[0];
|
||||
// note: b might be < r->cloneid if a snap has been trimmed.
|
||||
b = r->snaps[r->snaps.size()-1];
|
||||
}
|
||||
ldout(cct, 20) << " clone " << r->cloneid << " snaps " << r->snaps
|
||||
<< " -> [" << a << "," << b << "]"
|
||||
|
Loading…
Reference in New Issue
Block a user