From 86a8f6615199d2319994dba221f976abdc8f4636 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 9 Jan 2025 14:49:22 +0100 Subject: [PATCH] crush/CrushWrapper: un-inline methods to fix linker errors 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 --- src/crush/CrushWrapper.cc | 19 +++++++++++++++++++ src/crush/CrushWrapper.h | 17 ++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 44fd84e400e..cf4ad46e695 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -30,6 +30,25 @@ using ceph::decode_nohead; 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; imax_buckets; ++i) { diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index ef7d2b99765..7d76713284a 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -93,25 +93,12 @@ public: 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; -- 2.39.5