Problem:
Before this change, when the ISA plugin (classic build, dlopen'd),
would try to log, it'd segfault due to null g_ceph_context.
We need a way to make logging work for EC plugins in crimson.
Solution:
By building the ISA plugin WITH_CRIMSON, its logging is
routed to seastar's logger, solving the issue.
It is not build separately and dlopen'd like in classic because
doing so would require the plugin to have its own seastar logger
copy, an undesirable outcome.
It is a statically built library in the crimson-osd binary, and thus
it shares the single seastar logger. The library is linked with
--whole-archive so the self-registration constructor is not dropped.
Signed-off-by: Shraddha Agrawal <shraddha.agrawal000@gmail.com>
add_subdirectory(os)
add_subdirectory(osd)
add_subdirectory(tools)
+
+if(WITH_EC_ISA_PLUGIN)
+ add_library(ec_isa_crimson STATIC
+ ${PROJECT_SOURCE_DIR}/src/erasure-code/isa/ErasureCodeIsa.cc
+ ${PROJECT_SOURCE_DIR}/src/erasure-code/isa/ErasureCodeIsaTableCache.cc
+ ${PROJECT_SOURCE_DIR}/src/erasure-code/isa/ErasureCodePluginIsa.cc
+ $<TARGET_OBJECTS:erasure_code_objs>)
+ target_link_libraries(ec_isa_crimson PUBLIC ISAL::ISAL crimson::cflags)
+ target_compile_definitions(ec_isa_crimson INTERFACE WITH_EC_ISA_PLUGIN)
+ target_link_libraries(crimson-osd
+ -Wl,--whole-archive ec_isa_crimson -Wl,--no-whole-archive)
+endif()
auto plugin = std::make_unique<ErasureCodePluginIsa>();
int r = instance.add(plugin_name, plugin.get());
if (r == 0) {
- plugin.release();
+ plugin.release();
}
return r;
}
+
+#ifdef WITH_CRIMSON
+[[maybe_unused]] static int _isa_builtin =
+ ceph::ErasureCodePluginRegistry::register_builtin(
+ "isa", []{ return new ErasureCodePluginIsa(); });
+#endif