]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: use the seastar span sink API and build at API level 10
authorKefu Chai <k.chai@proxmox.com>
Fri, 26 Jun 2026 07:56:35 +0000 (15:56 +0800)
committerKefu Chai <k.chai@proxmox.com>
Tue, 28 Jul 2026 08:05:39 +0000 (16:05 +0800)
At SEASTAR_API_LEVEL >= 9 seastar dropped output_stream::write(net::packet) in
favour of write(std::span<temporary_buffer<char>>). 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 <k.chai@proxmox.com>
src/CMakeLists.txt
src/crimson/net/Socket.cc

index 656958ce177b6e43017481cdf4aaa884538842d9..5a836c88cba7cb6e4a685772fafe4829df7689ea 100644 (file)
@@ -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)
index 97f25dcc42716f277808e63e013d816ff95babd2..6a36b9ef427b6758cbc91dc69e29c36685d2c07c 100644 (file)
@@ -5,8 +5,11 @@
 
 #include <seastar/core/sleep.hh>
 #include <seastar/core/when_all.hh>
+#include <seastar/core/do_with.hh>
 #include <seastar/net/packet.hh>
 
+#include <span>
+
 #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<seastar::temporary_buffer<char>>(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<seastar::temporary_buffer<char>>(frags));
+      }).then([this] {
         return out.flush();
       });
     });