%{_libdir}/librbd_tp.so
%endif
+%if 0%{with crimson}
+%package -n librbd-crimson1
+Summary: Crimson RBD client library (Seastar-native)
+%if 0%{?suse_version}
+Group: System/Libraries
+%endif
+%description -n librbd-crimson1
+librbd-crimson is a Seastar-native RBD client library for the Ceph
+distributed storage system. Requires Crimson build (WITH_CRIMSON=ON).
+
+%package -n librbd-crimson-devel
+Summary: Crimson RBD client headers
+%if 0%{?suse_version}
+Group: Development/Libraries/C and C++
+%endif
+Requires: librbd-crimson1 = %{_epoch_prefix}%{version}-%{release}
+Provides: librbd-crimson1-devel = %{_epoch_prefix}%{version}-%{release}
+%description -n librbd-crimson-devel
+Headers and development files for librbd-crimson
+
+%files -n librbd-crimson1
+%{_libdir}/librbd_crimson.so.*
+
+%post -n librbd-crimson1 -p /sbin/ldconfig
+
+%postun -n librbd-crimson1 -p /sbin/ldconfig
+
+%files -n librbd-crimson-devel
+%{_includedir}/rbd/rbd_crimson.h
+%{_libdir}/librbd_crimson.so
+%endif
+
%files -n librgw2
%{_libdir}/librgw.so.*
%if %{with lttng}
# librbd_crimson - Seastar-native RBD client
-# Phase 1: Library skeleton, RBD header read, rbd_open/close/stat
set(crimson_rbd_srcs
utils.cc
api/io.cc
api/cluster.cc
api/metadata.cc
+ api/external_thread.cc
)
-add_library(librbd_crimson STATIC ${crimson_rbd_srcs})
+# Build shared lib when ENABLE_SHARED (for RPM packaging); else static
+add_library(librbd_crimson ${CEPH_SHARED} ${crimson_rbd_srcs})
target_include_directories(librbd_crimson
PUBLIC
PRIVATE
cls_rbd_client
)
+
+if(ENABLE_SHARED)
+ set_target_properties(librbd_crimson PROPERTIES
+ OUTPUT_NAME rbd_crimson
+ VERSION 1.0.0
+ SOVERSION 1
+ CXX_VISIBILITY_PRESET hidden
+ VISIBILITY_INLINES_HIDDEN ON)
+endif()
+
+install(TARGETS librbd_crimson
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 sts=2 expandtab
+//
+// SPDX-License-Identifier: BSD-3-Clause
+// Copyright (C) 2025 Red Hat
+//
+// Phase A1: External-thread integration for SPDK reactor.
+// Bridges SPDK reactor loop to Seastar run_one_tick / register APIs.
+// Part of librbd_crimson; SPDK links librbd_crimson, no direct Seastar dep.
+
+#include "include/rbd/rbd_crimson.h"
+
+#include <memory>
+
+#include <seastar/core/app-template.hh>
+#include <seastar/core/reactor.hh>
+#include <seastar/core/smp.hh>
+#include <seastar/util/log.hh>
+
+namespace {
+
+std::unique_ptr<seastar::app_template> g_app;
+
+} // anonymous namespace
+
+extern "C" {
+
+int rbd_crimson_configure_external_threads(unsigned core_count)
+{
+ try {
+ seastar::app_template::seastar_options opts;
+ opts.smp_opts.thread_affinity.set_value(false);
+ opts.smp_opts.mbind.set_value(false);
+ opts.smp_opts.smp.set_value(core_count);
+ opts.smp_opts.lock_memory.set_value(false);
+ opts.log_opts.default_log_level.set_value(seastar::log_level::error);
+ opts.reactor_opts.no_handle_interrupt.set_value(true);
+
+ g_app = std::make_unique<seastar::app_template>(std::move(opts));
+ if (g_app->configure_external_thread_mode(core_count) != 0) {
+ g_app.reset();
+ return -1;
+ }
+ return 0;
+ } catch (...) {
+ return -1;
+ }
+}
+
+void rbd_crimson_register_reactor(unsigned shard_id)
+{
+ g_app->register_reactor_on_this_thread(shard_id);
+}
+
+int rbd_crimson_run_one_tick(void)
+{
+ return seastar::engine().run_one_tick() ? 1 : 0;
+}
+
+void rbd_crimson_reactor_cleanup(void)
+{
+ seastar::smp::cleanup_cpu();
+}
+
+void rbd_crimson_cleanup_all(void)
+{
+ if (g_app) {
+ g_app->cleanup_external_thread_mode();
+ g_app.reset();
+ }
+}
+
+} // extern "C"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rbd)
endif()
+if(WITH_CRIMSON)
+ install(FILES
+ rbd/rbd_crimson.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rbd)
+endif()
+
if(WITH_RADOSGW)
install(FILES
rados/librgw.h
void *rbd_aio_get_arg(rbd_completion_t c);
void rbd_aio_release(rbd_completion_t c);
+/* Phase A1: External-thread integration for SPDK reactor
+ * When SPDK hosts the threads, each reactor thread runs a Seastar reactor.
+ * Call these from SPDK reactor loop. Part of librbd_crimson; no direct
+ * SPDK->Seastar dependency. Build ceph-nvmeof against librbd_crimson RPM.
+ */
+
+/** Configure Seastar for external-thread mode. Call once before spdk_reactors_start(). */
+int rbd_crimson_configure_external_threads(unsigned core_count);
+
+/** Register a Seastar reactor on the current thread. Call once per SPDK reactor thread. */
+void rbd_crimson_register_reactor(unsigned shard_id);
+
+/** Advance the Seastar reactor one tick. Call once per reactor loop iteration. Returns 1 if more work, 0 if stopped. */
+int rbd_crimson_run_one_tick(void);
+
+/** Clean up the Seastar reactor on the current thread. Call when SPDK reactor thread exits. */
+void rbd_crimson_reactor_cleanup(void);
+
+/** Clean up all Seastar resources. Call from main thread after spdk_reactors_fini. */
+void rbd_crimson_cleanup_all(void);
+
#ifdef __cplusplus
}
#endif
-Subproject commit 7347cf6f4f966929d5dc5b3fd7e34d771c9b3f85
+Subproject commit 6e70097b40d2673fc9ca86b16ebd564e300e4592