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_,
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();
}
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];
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);
}
}
// 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;
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;
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;
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);
}
*
* 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);
}
}
}
* 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);
}
}
}