int c = i.first;
int cid = i.second;
const char* class_name = crush.get_class_name(c);
- assert(class_name);
+ ceph_assert(class_name);
out << "\tid " << cid << " class " << class_name << "\t\t# do not change unnecessarily\n";
}
}
std::map<int, dcb_state_t>::value_type val(cur, DCB_STATE_IN_PROGRESS);
std::pair <std::map<int, dcb_state_t>::iterator, bool> rval
(dcb_states.insert(val));
- assert(rval.second);
+ ceph_assert(rval.second);
c = rval.first;
}
else if (c->second == DCB_STATE_DONE) {
// now do the items.
if (!used_items.empty())
- size = MAX(size, *used_items.rbegin());
+ size = std::max(size, *used_items.rbegin());
vector<int> items(size);
vector<int> weights(size);
item_id[name] = id;
item_weight[id] = bucketweight;
- assert(id != 0);
+ ceph_assert(id != 0);
int idout;
int r = crush.add_bucket(id, alg, hash, type, size,
- &items[0], &weights[0], &idout);
+ items.data(), weights.data(), &idout);
if (r < 0) {
if (r == -EEXIST)
err << "Duplicate bucket id " << id << std::endl;
return -1;
}
}
- assert(step == steps);
+ ceph_assert(step == steps);
return 0;
}
err << choose_arg_index << " duplicated" << std::endl;
return -1;
}
+ const auto max_buckets = crush.get_max_buckets();
+ if (max_buckets < 0) {
+ err << "get_max_buckets() returned error" << std::endl;
+ return -1;
+ }
crush_choose_arg_map arg_map;
- arg_map.size = crush.get_max_buckets();
+ arg_map.size = max_buckets;
arg_map.args = (crush_choose_arg *)calloc(arg_map.size, sizeof(crush_choose_arg));
for (iter_t p = i->children.begin() + 2; p != i->children.end(); p++) {
int r = 0;
int cpos = info.stop - start;
//out << "cpos " << cpos << std::endl;
//out << " linemap " << line_pos << std::endl;
- assert(!line_pos.empty());
+ ceph_assert(!line_pos.empty());
map<int,int>::iterator p = line_pos.upper_bound(cpos);
if (p != line_pos.begin())
--p;