I can't for the life of me figure out what this is supposed to do.
- why remove (some) classes right after we populated them?
- why remove them after we decode the crush map?
Signed-off-by: Sage Weil <sage@redhat.com>
int CrushCompiler::decompile(ostream &out)
{
- crush.cleanup_classes();
-
out << "# begin crush map\n";
// only dump tunables if they differ from the defaults
}
//err << "max_devices " << crush.get_max_devices() << std::endl;
- crush.cleanup_classes();
crush.finalize();
return 0;
return 0;
}
-int CrushWrapper::cleanup_classes()
-{
- return trim_roots_with_class(true);
-}
-
int CrushWrapper::trim_roots_with_class(bool unused)
{
set<int> roots;
if (r < 0)
return r;
class_bucket.clear();
- r = populate_classes(old_class_bucket);
- if (r < 0)
- return r;
- return trim_roots_with_class(true);
+ return populate_classes(old_class_bucket);
}
void CrushWrapper::encode(bufferlist& bl, uint64_t features) const
for (auto &c : class_name)
class_rname[c.second] = c.first;
::decode(class_bucket, blp);
- cleanup_classes();
}
if (!blp.end()) {
__u32 choose_args_size;
int rebuild_roots_with_classes();
/* remove unused roots generated for class devices */
int trim_roots_with_class(bool unused);
- int cleanup_classes();
void start_choose_profile() {
free(crush->choose_tries);
ASSERT_EQ(-1, retrieved_class_id);
}
-TEST(CrushWrapper, populate_and_cleanup_classes) {
+TEST(CrushWrapper, populate_classes) {
CrushWrapper c;
c.create();
c.set_type_name(1, "root");
old_class_bucket = c.class_bucket;
ASSERT_EQ(c.populate_classes(old_class_bucket), 0);
ASSERT_EQ(old_class_bucket, c.class_bucket);
-
- c.class_bucket.clear();
- ASSERT_EQ(c.cleanup_classes(), 0);
- ASSERT_FALSE(c.name_exists("default~ssd"));
}
TEST(CrushWrapper, remove_class_name) {