From 108583c6bed0fa53e489fe71537e3be875635f3c Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 8 Aug 2018 16:46:16 +0800 Subject: [PATCH] crush/CrushWrapper: get_children_of_type - switch outcome to vector Because we don't really care about the order. Signed-off-by: xie xingguo --- src/crush/CrushWrapper.cc | 8 ++++---- src/crush/CrushWrapper.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index e54e4939deb..e3747859ccd 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -860,13 +860,13 @@ int CrushWrapper::get_children(int id, list *children) const void CrushWrapper::get_children_of_type(int id, int type, - set *children, + vector *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 roots; find_takes_by_rule(rule, &roots); for (auto root : roots) { - set candidates; + vector candidates; get_children_of_type(root, type, &candidates, false); for (auto candidate : candidates) { if (subtree_contains(candidate, item)) { diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 9c8af9b418d..36f8012fd87 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -739,7 +739,7 @@ public: int get_children(int id, list *children) const; void get_children_of_type(int id, int type, - set *children, + vector *children, bool exclude_shadow = true) const; /** -- 2.39.5