]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
src/crimson/osd: statically link the ISA plugin in crimson-osd 70481/head
authorShraddha Agrawal <shraddha.agrawal000@gmail.com>
Fri, 24 Jul 2026 08:21:36 +0000 (13:51 +0530)
committerShraddha Agrawal <shraddha.agrawal000@gmail.com>
Fri, 24 Jul 2026 08:21:36 +0000 (13:51 +0530)
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>
src/crimson/CMakeLists.txt
src/erasure-code/isa/ErasureCodePluginIsa.cc

index 2a97044226b21cc83e53f57ceed9427f97ab0f82..e0fe354fd0f2052f868949367c4087adecfdced2 100644 (file)
@@ -209,3 +209,15 @@ add_subdirectory(admin)
 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()
index 7904f407d7cfa3a4b83981ca86592544657ca9a1..817d9bd3af3d758ed60dd1161a6ed66dbbd6606f 100644 (file)
@@ -81,7 +81,13 @@ int __erasure_code_init(char *plugin_name, char *directory)
   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