]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: fix output arg for find_{takes,roots}()
authorSage Weil <sage@redhat.com>
Sun, 23 Jul 2017 03:51:47 +0000 (23:51 -0400)
committerNathan Cutler <ncutler@suse.com>
Thu, 19 Oct 2017 12:15:10 +0000 (14:15 +0200)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 60b9cfafc3128cc0cb1f89137221fcc46fcd3802)

src/crush/CrushTreeDumper.h
src/crush/CrushWrapper.cc
src/crush/CrushWrapper.h
src/tools/crushtool.cc

index 4a3da9b82ff93d6e3095c2f065f2141cdba52999..6591b1bcdb40749f916fc21228c655114542c8eb 100644 (file)
@@ -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();
     }
index bf6f3cf5ab8d69aa7bea8ad4562d0a1093102b9b..2229b91da2db1fd5623f5ca0343f7098feecec6e 100644 (file)
@@ -318,7 +318,7 @@ int CrushWrapper::rename_rule(const string& srcname,
   return 0;
 }
 
-void CrushWrapper::find_takes(set<int>roots) const
+void CrushWrapper::find_takes(set<int> *roots) const
 {
   for (unsigned i=0; i<crush->max_rules; i++) {
     crush_rule *r = crush->rules[i];
@@ -326,19 +326,19 @@ void CrushWrapper::find_takes(set<int>& roots) const
       continue;
     for (unsigned j=0; j<r->len; 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<int>roots) const
+void CrushWrapper::find_roots(set<int> *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<int,map<int,vector<int>>> cmap_item_weight; // cargs -> bno -> weights
   set<int> 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<int> 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<int> roots;
-  find_roots(roots);
+  find_roots(&roots);
   for (set<int>::iterator p = roots.begin(); p != roots.end(); ++p) {
     if (*p >= 0)
       continue;
@@ -2604,7 +2604,7 @@ namespace {
 
     void dump(Formatter *f) {
       set<int> roots;
-      crush->find_roots(roots);
+      crush->find_roots(&roots);
       for (set<int>::iterator root = roots.begin(); root != roots.end(); ++root) {
        dump_item(Item(*root, 0, 0, crush->get_bucket_weightf(*root)), f);
       }
index 384af2c442692357969c9d483b27b5f821b3b2f2..297eee52b70bf72bb4db0505fdcf1b8a02be4bd1 100644 (file)
@@ -574,25 +574,25 @@ public:
    *
    * Note that these may not be parentless roots.
    */
-  void find_takes(set<int>roots) const;
+  void find_takes(set<int> *roots) const;
 
   /**
    * find tree roots
    *
    * These are parentless nodes in the map.
    */
-  void find_roots(set<int>roots) const;
+  void find_roots(set<int> *roots) const;
 
 
   /**
    * find tree roots that contain shadow (device class) items only
    */
-  void find_shadow_roots(set<int>roots) const {
+  void find_shadow_roots(set<int> *roots) const {
     set<int> 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<int>roots) const {
+  void find_nonshadow_roots(set<int> *roots) const {
     set<int> all;
-    find_roots(all);
+    find_roots(&all);
     for (auto& p: all) {
       if (!is_shadow_item(p)) {
-        roots.insert(p);
+        roots->insert(p);
       }
     }
   }
index 2a1bc83b8f86fda509dc51cd9f597bd20174dfba..c2dbaae84fce2e32b0125a35c8a34072d4f74eec 100644 (file)
@@ -829,7 +829,7 @@ int main(int argc, const char **argv)
 
     {
       set<int> 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"