From: Kefu Chai Date: Fri, 26 Jun 2026 07:56:35 +0000 (+0800) Subject: crimson: use the seastar span sink API and build at API level 10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dcbe48ff0bee47b9c06b506bc4be3e7ffdb6f683;p=ceph.git crimson: use the seastar span sink API and build at API level 10 At SEASTAR_API_LEVEL >= 9 seastar dropped output_stream::write(net::packet) in favour of write(std::span>). Convert Socket's writes to the span form, writing the packet's released fragments and keeping them alive across the write with do_with, then raise Seastar_API_LEVEL from 6 to 10 to match the updated seastar. The span write overloads are unconditional, so the Socket change is valid at every API level. Signed-off-by: Kefu Chai --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 656958ce177b..5a836c88cba7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -472,7 +472,7 @@ if(WITH_CRIMSON) _find_package(${ARGV}) endif() endmacro () - set(Seastar_API_LEVEL "6" CACHE STRING "" FORCE) + set(Seastar_API_LEVEL "10" CACHE STRING "" FORCE) set(Seastar_IO_URING ${HAVE_LIBURING} CACHE BOOL "" FORCE) set(Seastar_DEPRECATED_OSTREAM_FORMATTERS OFF CACHE BOOL "" FORCE) if(WITH_ASAN) diff --git a/src/crimson/net/Socket.cc b/src/crimson/net/Socket.cc index 97f25dcc4271..6a36b9ef427b 100644 --- a/src/crimson/net/Socket.cc +++ b/src/crimson/net/Socket.cc @@ -5,8 +5,11 @@ #include #include +#include #include +#include + #include "crimson/common/config_proxy.h" // for local_conf() #include "crimson/common/log.h" #include "include/random.h" // for ceph::util::generate_random_number() @@ -191,7 +194,9 @@ Socket::write(bufferlist buf) return inject_delay( ).then([buf = std::move(buf), this]() mutable { packet p(std::move(buf)); - return out.write(std::move(p)); + return seastar::do_with(p.release(), [this](auto& frags) { + return out.write(std::span>(frags)); + }); }); #ifdef UNIT_TESTS_BUILT }).then([this] { @@ -222,8 +227,9 @@ Socket::write_flush(bufferlist buf) return inject_delay( ).then([buf = std::move(buf), this]() mutable { packet p(std::move(buf)); - return out.write(std::move(p) - ).then([this] { + return seastar::do_with(p.release(), [this](auto& frags) { + return out.write(std::span>(frags)); + }).then([this] { return out.flush(); }); });