{
dout(5) << "export_empties checking for empty imports" << dendl;
- for (map<CDir*,set<CDir*> >::iterator it = mds->mdcache->subtrees.begin();
- it != mds->mdcache->subtrees.end();
- ++it) {
- CDir *dir = it->first;
- if (!dir->is_auth() ||
- dir->is_ambiguous_auth() ||
- dir->is_freezing() ||
- dir->is_frozen())
+ std::set<CDir *> subtrees;
+ mds->mdcache->get_fullauth_subtrees(subtrees);
+ for (auto &dir : subtrees) {
+ if (dir->is_freezing() || dir->is_frozen())
continue;
if (!dir->inode->is_base() &&
if (bounds != subtrees[dir]) {
dout(0) << "verify_subtree_bounds failed" << dendl;
set<CDir*> b = bounds;
- for (set<CDir*>::iterator p = subtrees[dir].begin();
- p != subtrees[dir].end();
- ++p) {
- if (bounds.count(*p)) {
- b.erase(*p);
+ for (auto &cd : subtrees[dir]) {
+ if (bounds.count(cd)) {
+ b.erase(cd);
continue;
}
- dout(0) << " missing bound " << **p << dendl;
+ dout(0) << " missing bound " << *cd << dendl;
}
- for (set<CDir*>::iterator p = b.begin();
- p != b.end();
- ++p)
- dout(0) << " extra bound " << **p << dendl;
+ for (const auto &cd : b)
+ dout(0) << " extra bound " << *cd << dendl;
}
assert(bounds == subtrees[dir]);
}
// make sure that any bounds i do have are properly noted as such.
int failed = 0;
- for (list<dirfrag_t>::const_iterator p = bounds.begin();
- p != bounds.end();
- ++p) {
- CDir *bd = get_dirfrag(*p);
+ for (const auto &fg : bounds) {
+ CDir *bd = get_dirfrag(fg);
if (!bd) continue;
if (subtrees[dir].count(bd) == 0) {
dout(0) << "verify_subtree_bounds failed: extra bound " << *bd << dendl;
}
// unpin bounds
- for (set<CDir*>::iterator p = bounds.begin();
- p != bounds.end();
- ++p) {
- CDir *bd = *p;
+ for (const auto &bd : bounds) {
bd->put(CDir::PIN_EXPORTBOUND);
bd->state_clear(CDir::STATE_EXPORTBOUND);
}