The `crush_objs` library is not part of the `libceph-common` ABI, so
applications linking with `libceph-common` may fail to build because
the linker cannot find `crush_destroy()`.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
using ceph::encode;
using ceph::Formatter;
+CrushWrapper::~CrushWrapper()
+{
+ if (crush)
+ crush_destroy(crush);
+ choose_args_clear();
+}
+
+void CrushWrapper::create()
+{
+ if (crush)
+ crush_destroy(crush);
+ crush = crush_create();
+ choose_args_clear();
+ ceph_assert(crush);
+ have_rmaps = false;
+
+ set_tunables_default();
+}
+
bool CrushWrapper::has_non_straw2_buckets() const
{
for (int i=0; i<crush->max_buckets; ++i) {
CrushWrapper() {
create();
}
- ~CrushWrapper() {
- if (crush)
- crush_destroy(crush);
- choose_args_clear();
- }
+ ~CrushWrapper();
crush_map *get_crush_map() { return crush; }
/* building */
- void create() {
- if (crush)
- crush_destroy(crush);
- crush = crush_create();
- choose_args_clear();
- ceph_assert(crush);
- have_rmaps = false;
-
- set_tunables_default();
- }
+ void create();
/// true if any buckets that aren't straw2
bool has_non_straw2_buckets() const;