Signed-off-by: Sage Weil <sage@redhat.com>
class Dumper : public list<Item> {
public:
explicit Dumper(const CrushWrapper *crush_) : crush(crush_) {
- crush->find_roots(roots);
+ crush->find_nonshadow_roots(roots);
root = roots.begin();
}
}
}
+void CrushWrapper::find_nonshadow_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))
+ continue;
+ const char *name = get_item_name(b->id);
+ if (name && !is_valid_crush_name(name))
+ continue;
+ roots.insert(b->id);
+ }
+}
+
bool CrushWrapper::subtree_contains(int root, int item) const
{
if (root == item)
*/
void find_roots(set<int>& roots) const;
+ /**
+ * find tree roots that are not shadow (device class) items
+ *
+ * These are parentless nodes in the map that are not shadow
+ * items for device classes.
+ */
+ void find_nonshadow_roots(set<int>& roots) const;
+
/**
* see if an item is contained within a subtree
*