class_remove_item(item);
}
}
- rebuild_roots_with_classes();
+ rebuild_roots_with_classes(cct);
return true;
}
-int CrushWrapper::remove_root(int item)
+int CrushWrapper::remove_root(CephContext *cct, int item)
{
crush_bucket *b = get_bucket(item);
if (IS_ERR(b)) {
for (unsigned n = 0; n < b->size; n++) {
if (b->items[n] >= 0)
continue;
- int r = remove_root(b->items[n]);
+ int r = remove_root(cct, b->items[n]);
if (r < 0)
return r;
}
if (class_bucket.count(item) != 0)
class_bucket.erase(item);
class_remove_item(item);
- update_choose_args(nullptr);
+ update_choose_args(cct);
return 0;
}
ldout(cct, 5) << "insert_item max_devices now " << crush->max_devices
<< dendl;
}
- r = rebuild_roots_with_classes();
+ r = rebuild_roots_with_classes(cct);
if (r < 0) {
ldout(cct, 0) << __func__ << " unable to rebuild roots with classes: "
<< cpp_strerror(r) << dendl;
// swap names
swap_names(src, dst);
- return rebuild_roots_with_classes();
+ return rebuild_roots_with_classes(cct);
}
int CrushWrapper::link_bucket(
return 0;
}
-int CrushWrapper::trim_roots_with_class()
+int CrushWrapper::trim_roots_with_class(CephContext *cct)
{
set<int> roots;
find_shadow_roots(&roots);
for (auto &r : roots) {
if (r >= 0)
continue;
- int res = remove_root(r);
+ int res = remove_root(cct, r);
if (res)
return res;
}
}
}
- int r = rebuild_roots_with_classes();
+ int r = rebuild_roots_with_classes(cct);
if (r < 0) {
out << "failed to rebuild_roots_with_classes: " << cpp_strerror(r)
<< std::endl;
name_map[i.first] = i.second;
}
- int r = rebuild_roots_with_classes();
+ int r = rebuild_roots_with_classes(cct);
if (r < 0) {
out << "failed to rebuild_roots_with_classes: " << cpp_strerror(r)
<< std::endl;
reweight_bucket(b, i.second, &w);
}
}
- int r = rebuild_roots_with_classes();
+ int r = rebuild_roots_with_classes(cct);
ceph_assert(r == 0);
}
crush->rules[ruleno] = NULL;
rule_name_map.erase(ruleno);
have_rmaps = false;
- return rebuild_roots_with_classes();
+ return rebuild_roots_with_classes(nullptr);
}
int CrushWrapper::bucket_adjust_item_weight(CephContext *cct, crush_bucket *bucket, int item, int weight)
set_item_class(id, class_id);
- int r = rebuild_roots_with_classes();
+ int r = rebuild_roots_with_classes(nullptr);
if (r < 0)
return r;
return 1;
}
class_remove_item(id);
- int r = rebuild_roots_with_classes();
+ int r = rebuild_roots_with_classes(cct);
if (r < 0) {
*ss << "unable to rebuild roots with class '" << class_name << "' "
<< "of osd." << id << ": " << cpp_strerror(r);
}
}
-int CrushWrapper::rebuild_roots_with_classes()
+int CrushWrapper::rebuild_roots_with_classes(CephContext *cct)
{
std::map<int32_t, map<int32_t, int32_t> > old_class_bucket = class_bucket;
cleanup_dead_classes();
- int r = trim_roots_with_class();
+ int r = trim_roots_with_class(cct);
if (r < 0)
return r;
class_bucket.clear();
* @param item id to remove
* @return 0 on success, negative on error
*/
- int remove_root(int item);
+ int remove_root(CephContext *cct, int item);
/**
* remove all instances of an item nested beneath a certain point from the map
int get_rules_by_osd(int osd, set<int> *rules);
bool _class_is_dead(int class_id);
void cleanup_dead_classes();
- int rebuild_roots_with_classes();
+ int rebuild_roots_with_classes(CephContext *cct);
/* remove unused roots generated for class devices */
- int trim_roots_with_class();
+ int trim_roots_with_class(CephContext *cct);
int reclassify(
CephContext *cct,
ASSERT_TRUE(c.name_exists("default"));
ASSERT_TRUE(c.name_exists("r11"));
ASSERT_TRUE(c.name_exists("r12"));
- ASSERT_EQ(c.remove_root(c.get_item_id("default")), 0);
+ ASSERT_EQ(c.remove_root(g_ceph_context, c.get_item_id("default")), 0);
ASSERT_FALSE(c.name_exists("default"));
ASSERT_FALSE(c.name_exists("r11"));
ASSERT_FALSE(c.name_exists("r12"));
ASSERT_TRUE(c.name_exists("default"));
ASSERT_TRUE(c.name_exists("default~ssd"));
- c.trim_roots_with_class();
+ c.trim_roots_with_class(g_ceph_context);
ASSERT_TRUE(c.name_exists("default"));
ASSERT_FALSE(c.name_exists("default~ssd"));
}