From: xie xingguo Date: Sat, 1 Jul 2017 10:47:42 +0000 (+0800) Subject: mon/OSDMonitor: tidy up class_map too on crush removal X-Git-Tag: v12.1.1~42^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a9a0bc85ec12f2ab928bca1c170ca4a99111e3e9;p=ceph.git mon/OSDMonitor: tidy up class_map too on crush removal Signed-off-by: xie xingguo --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 15ce05139bc7..ff90bad94da8 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -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; } diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index e4aae0c87050..ba676840bf43 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -525,6 +525,13 @@ public: } } } + 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;