diff options
author | Sage Weil <sage@newdream.net> | 2008-08-07 20:20:08 +0200 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2008-08-07 20:20:08 +0200 |
commit | e54851f3d1c2affb323f5d5d6ec6b73f62e5bd13 (patch) | |
tree | df12eacee7ad9676d07955c658dfbbf303c3e6e6 /src/mds/snap.cc | |
parent | osd: fix head deletion (diff) | |
download | ceph-e54851f3d1c2affb323f5d5d6ec6b73f62e5bd13.tar.xz ceph-e54851f3d1c2affb323f5d5d6ec6b73f62e5bd13.zip |
mds: do not purge strays with snapped references/past parents
Diffstat (limited to 'src/mds/snap.cc')
-rw-r--r-- | src/mds/snap.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mds/snap.cc b/src/mds/snap.cc index ff9a1006966..856027ed22b 100644 --- a/src/mds/snap.cc +++ b/src/mds/snap.cc @@ -480,3 +480,25 @@ void SnapRealm::add_past_parent(SnapRealm *oldparent) invalidate_cached_snaps(); } + +void SnapRealm::prune_past_parents() +{ + dout(10) << "prune_past_parents" << dendl; + check_cache(); + assert(open); + + map<snapid_t, snaplink_t>::iterator p = past_parents.begin(); + while (p != past_parents.end()) { + set<snapid_t>::iterator q = cached_snaps.lower_bound(p->second.first); + if (q == cached_snaps.end() || + *q > p->first) { + dout(10) << "prune_past_parents pruning [" << p->second.first << "," << p->first + << "] " << p->second.ino << dendl; + past_parents.erase(p++); + } else { + dout(10) << "prune_past_parents keeping [" << p->second.first << "," << p->first + << "] " << p->second.ino << dendl; + p++; + } + } +} |