]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: get_children_of_type - switch outcome to vector
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 8 Aug 2018 08:46:16 +0000 (16:46 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 8 Aug 2018 08:46:16 +0000 (16:46 +0800)
Because we don't really care about the order.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/crush/CrushWrapper.cc
src/crush/CrushWrapper.h

index e54e4939debe765661028ee8867b2783e4a02b3e..e3747859ccd5df170d9c5cd650c9030e3bf20fe3 100644 (file)
@@ -860,13 +860,13 @@ int CrushWrapper::get_children(int id, list<int> *children) const
 
 void CrushWrapper::get_children_of_type(int id,
                                         int type,
-                                       set<int> *children,
+                                       vector<int> *children,
                                        bool exclude_shadow) const
 {
   if (id >= 0) {
     if (type == 0) {
       // want leaf?
-      children->insert(id);
+      children->push_back(id);
     }
     return;
   }
@@ -879,7 +879,7 @@ void CrushWrapper::get_children_of_type(int id,
     return;
   } else if (b->type == type) {
     if (!is_shadow_item(b->id) || !exclude_shadow) {
-      children->insert(b->id);
+      children->push_back(b->id);
     }
     return;
   }
@@ -1510,7 +1510,7 @@ int CrushWrapper::get_parent_of_type(int item, int type, int rule) const
   set<int> roots;
   find_takes_by_rule(rule, &roots);
   for (auto root : roots) {
-    set<int> candidates;
+    vector<int> candidates;
     get_children_of_type(root, type, &candidates, false);
     for (auto candidate : candidates) {
       if (subtree_contains(candidate, item)) {
index 9c8af9b418d29dcbe94791d74172808eb4c9aa36..36f8012fd87a7794af07a98314662cc5d4d359d9 100644 (file)
@@ -739,7 +739,7 @@ public:
   int get_children(int id, list<int> *children) const;
   void get_children_of_type(int id,
                             int type,
-                           set<int> *children,
+                           vector<int> *children,
                            bool exclude_shadow = true) const;
 
   /**