]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: log io_state_t out of line in shard_states_t
authorKefu Chai <k.chai@proxmox.com>
Tue, 16 Jun 2026 12:25:45 +0000 (20:25 +0800)
committerKefu Chai <k.chai@proxmox.com>
Wed, 17 Jun 2026 08:54:51 +0000 (16:54 +0800)
try_enter_out_dispatching()'s impossible default case logs io_state_t,
which would instantiate fmt::formatter<io_state_t> inside IOHandler,
before the formatter (declarable only after the class, since io_state_t
is nested) is visible. move just that abort path to io_handler.cc, where
the formatter is in scope, and keep the hot switch inline.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/crimson/net/io_handler.cc
src/crimson/net/io_handler.h

index c08bdc87422fb2df7078d0458941c00424701ef4..df55f1b6f0702991cc33806feade5404dd69be06 100644 (file)
@@ -1293,6 +1293,14 @@ IOHandler::shard_states_t::notify_out_dispatching_stopped(
   }
 }
 
+void
+IOHandler::shard_states_t::abort_wrong_io_state(SocketConnection &conn)
+{
+  logger().error("{} try_enter_out_dispatching() got wrong io_state {}",
+                 conn, io_state);
+  ceph_abort_msg("impossible");
+}
+
 seastar::future<>
 IOHandler::shard_states_t::wait_io_exit_dispatching()
 {
index 9cb489af941e8012793ee814ad736ecafc59fa51..c86419c76b8fb7764207cffb4b0918180ae1211c 100644 (file)
@@ -326,13 +326,16 @@ public:
         // do not dispatch out
         return false;
       default:
-        crimson::get_logger(ceph_subsys_ms).error(
-          "{} try_enter_out_dispatching() got wrong io_state {}",
-          conn, io_state);
-        ceph_abort_msg("impossible");
+        abort_wrong_io_state(conn);
       }
     }
 
+    // defined out of line: logging io_state_t here, inside IOHandler, would
+    // instantiate fmt::formatter<io_state_t> before it is declared (it can
+    // only be declared after IOHandler). only this impossible-state path
+    // formats it, so keep the hot switch inline and move the abort out.
+    [[noreturn]] void abort_wrong_io_state(SocketConnection &conn);
+
     void notify_out_dispatching_stopped(
         const char *what, SocketConnection &conn);