Skip to content

Commit

Permalink
mon/OSDMonitor: tidy up class_map too on crush removal
Browse files Browse the repository at this point in the history
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
  • Loading branch information
xiexingguo committed Jul 1, 2017
1 parent 6ca23e6 commit 7d69fb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/crush/CrushWrapper.cc
Expand Up @@ -335,11 +335,13 @@ bool CrushWrapper::_maybe_remove_last_instance(CephContext *cct, int item, bool
crush_remove_bucket(crush, t);
if (class_bucket.count(item) != 0)
class_bucket.erase(item);
class_remove_item(item);
}
if ((item >= 0 || !unlink_only) && name_map.count(item)) {
ldout(cct, 5) << "_maybe_remove_last_instance removing name for item " << item << dendl;
name_map.erase(item);
have_rmaps = false;
class_remove_item(item);
}
return true;
}
Expand Down
7 changes: 7 additions & 0 deletions src/crush/CrushWrapper.h
Expand Up @@ -525,6 +525,13 @@ class CrushWrapper {
}
}
}
void class_remove_item(int i) {
auto it = class_map.find(i);
if (it == class_map.end()) {
return;
}
class_map.erase(it);
}
int can_rename_item(const string& srcname,
const string& dstname,
ostream *ss) const;
Expand Down

0 comments on commit 7d69fb4

Please sign in to comment.