From 6902627cb3cb41547be5134aba5c10a39b78163a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 22 Jul 2017 23:51:47 -0400 Subject: [PATCH] crush/CrushWrapper: fix output arg for find_{takes,roots}() Signed-off-by: Sage Weil (cherry picked from commit 60b9cfafc3128cc0cb1f89137221fcc46fcd3802) --- src/crush/CrushTreeDumper.h | 6 +++--- src/crush/CrushWrapper.cc | 16 ++++++++-------- src/crush/CrushWrapper.h | 16 ++++++++-------- src/tools/crushtool.cc | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/crush/CrushTreeDumper.h b/src/crush/CrushTreeDumper.h index 4a3da9b82ff93..6591b1bcdb407 100644 --- a/src/crush/CrushTreeDumper.h +++ b/src/crush/CrushTreeDumper.h @@ -68,7 +68,7 @@ namespace CrushTreeDumper { explicit Dumper(const CrushWrapper *crush_, const name_map_t& weight_set_names_) : crush(crush_), weight_set_names(weight_set_names_) { - crush->find_nonshadow_roots(roots); + crush->find_nonshadow_roots(&roots); root = roots.begin(); } explicit Dumper(const CrushWrapper *crush_, @@ -76,9 +76,9 @@ namespace CrushTreeDumper { bool show_shadow) : crush(crush_), weight_set_names(weight_set_names_) { if (show_shadow) { - crush->find_roots(roots); + crush->find_roots(&roots); } else { - crush->find_nonshadow_roots(roots); + crush->find_nonshadow_roots(&roots); } root = roots.begin(); } diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index bf6f3cf5ab8d6..2229b91da2db1 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -318,7 +318,7 @@ int CrushWrapper::rename_rule(const string& srcname, return 0; } -void CrushWrapper::find_takes(set& roots) const +void CrushWrapper::find_takes(set *roots) const { for (unsigned i=0; imax_rules; i++) { crush_rule *r = crush->rules[i]; @@ -326,19 +326,19 @@ void CrushWrapper::find_takes(set& roots) const continue; for (unsigned j=0; jlen; j++) { if (r->steps[j].op == CRUSH_RULE_TAKE) - roots.insert(r->steps[j].arg1); + roots->insert(r->steps[j].arg1); } } } -void CrushWrapper::find_roots(set& roots) const +void CrushWrapper::find_roots(set *roots) const { for (int i = 0; i < crush->max_buckets; i++) { if (!crush->buckets[i]) continue; crush_bucket *b = crush->buckets[i]; if (!_search_item_exists(b->id)) - roots.insert(b->id); + roots->insert(b->id); } } @@ -1439,7 +1439,7 @@ int CrushWrapper::populate_classes( // finish constructing the containing buckets. map>> cmap_item_weight; // cargs -> bno -> weights set roots; - find_nonshadow_roots(roots); + find_nonshadow_roots(&roots); for (auto &r : roots) { if (r >= 0) continue; @@ -1457,7 +1457,7 @@ int CrushWrapper::populate_classes( int CrushWrapper::trim_roots_with_class() { set roots; - find_shadow_roots(roots); + find_shadow_roots(&roots); for (auto &r : roots) { if (r >= 0) continue; @@ -1499,7 +1499,7 @@ int32_t CrushWrapper::_alloc_class_id() const { void CrushWrapper::reweight(CephContext *cct) { set roots; - find_roots(roots); + find_roots(&roots); for (set::iterator p = roots.begin(); p != roots.end(); ++p) { if (*p >= 0) continue; @@ -2604,7 +2604,7 @@ namespace { void dump(Formatter *f) { set roots; - crush->find_roots(roots); + crush->find_roots(&roots); for (set::iterator root = roots.begin(); root != roots.end(); ++root) { dump_item(Item(*root, 0, 0, crush->get_bucket_weightf(*root)), f); } diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 384af2c442692..297eee52b70bf 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -574,25 +574,25 @@ public: * * Note that these may not be parentless roots. */ - void find_takes(set& roots) const; + void find_takes(set *roots) const; /** * find tree roots * * These are parentless nodes in the map. */ - void find_roots(set& roots) const; + void find_roots(set *roots) const; /** * find tree roots that contain shadow (device class) items only */ - void find_shadow_roots(set& roots) const { + void find_shadow_roots(set *roots) const { set all; - find_roots(all); + find_roots(&all); for (auto& p: all) { if (is_shadow_item(p)) { - roots.insert(p); + roots->insert(p); } } } @@ -603,12 +603,12 @@ public: * These are parentless nodes in the map that are not shadow * items for device classes. */ - void find_nonshadow_roots(set& roots) const { + void find_nonshadow_roots(set *roots) const { set all; - find_roots(all); + find_roots(&all); for (auto& p: all) { if (!is_shadow_item(p)) { - roots.insert(p); + roots->insert(p); } } } diff --git a/src/tools/crushtool.cc b/src/tools/crushtool.cc index 2a1bc83b8f86f..c2dbaae84fce2 100644 --- a/src/tools/crushtool.cc +++ b/src/tools/crushtool.cc @@ -829,7 +829,7 @@ int main(int argc, const char **argv) { set roots; - crush.find_roots(roots); + crush.find_roots(&roots); if (roots.size() > 1) dout(1) << "The crush rulesets will use the root " << root << "\n" << "and ignore the others.\n" -- 2.39.5