mds: simplify loops to range-for

No functional change.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2017-04-11 15:06:22 -04:00
parent 36f3bc067f
commit 2d2b387372
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
3 changed files with 13 additions and 26 deletions

View File

@ -337,14 +337,10 @@ void MDBalancer::export_empties()
{
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() &&

View File

@ -1257,19 +1257,15 @@ void MDCache::verify_subtree_bounds(CDir *dir, const set<CDir*>& bounds)
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]);
}
@ -1281,10 +1277,8 @@ void MDCache::verify_subtree_bounds(CDir *dir, const list<dirfrag_t>& bounds)
// 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;

View File

@ -1700,10 +1700,7 @@ void Migrator::export_reverse(CDir *dir)
}
// 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);
}