]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: fmt 11 fixes
authorMatan Breizman <mbreizma@redhat.com>
Thu, 1 Aug 2024 12:53:29 +0000 (12:53 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 14 Aug 2024 09:56:25 +0000 (09:56 +0000)
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
19 files changed:
src/crimson/common/formatter.cc
src/crimson/mon/MonClient.cc
src/crimson/net/FrameAssemblerV2.cc
src/crimson/net/Socket.cc
src/crimson/net/SocketMessenger.cc
src/crimson/net/io_handler.cc
src/crimson/net/io_handler.h
src/crimson/os/seastore/journal/record_submitter.cc
src/crimson/os/seastore/onode_manager/staged-fltree/node_types.h
src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage.h
src/crimson/os/seastore/seastore.cc
src/crimson/os/seastore/segment_manager/block.cc
src/crimson/osd/osd_operations/scrub_events.cc
src/crimson/osd/osd_operations/scrub_events.h
src/crimson/osd/pg.cc
src/crimson/osd/pg_backend.cc
src/crimson/osd/recovery_backend.cc
src/crimson/osd/scrub/pg_scrubber.h
src/crimson/osd/watch.cc

index ab371ddbfce09e8163f5ea1eab9c933cdba0d645..9ced61d9848647b7210661e6014cb55919576777 100644 (file)
@@ -19,7 +19,7 @@ struct fmt::formatter<seastar::lowres_system_clock::time_point> {
 
   template <typename FormatContext>
   auto format(const seastar::lowres_system_clock::time_point& t,
-              FormatContext& ctx) {
+              FormatContext& ctx) const {
     std::time_t tt = std::chrono::duration_cast<std::chrono::seconds>(
       t.time_since_epoch()).count();
     auto milliseconds = (t.time_since_epoch() %
index 761c6b1a5c85746b901f70ca42590fb1a93fe8f3..b4be4bba3fe1672576188a6329ab70345226f39f 100644 (file)
@@ -14,6 +14,7 @@
 #include "auth/RotatingKeyRing.h"
 
 #include "common/hostname.h"
+#include "include/utime_fmt.h"
 
 #include "crimson/auth/KeyRing.h"
 #include "crimson/common/config_proxy.h"
@@ -243,7 +244,7 @@ Connection::do_auth_single(Connection::request_t what)
       return std::make_optional(auth_result_t::canceled);
     }
     logger().info("do_auth_single: {} returns {}: {}",
-                  *conn, *m, m->result);
+                  *conn, *m, (int)m->result);
     auto p = m->result_bl.cbegin();
     auto ret = auth->handle_response(m->result, p,
                                     nullptr, nullptr);
@@ -806,7 +807,7 @@ seastar::future<> Client::handle_auth_reply(crimson::net::Connection &conn,
                                             Ref<MAuthReply> m)
 {
   logger().info("handle_auth_reply {} returns {}: {}",
-                conn, *m, m->result);
+                conn, *m, (int)m->result);
   auto found = std::find_if(pending_conns.begin(), pending_conns.end(),
                             [peer_addr = conn.get_peer_addr()](auto& mc) {
                               return mc->is_my_peer(peer_addr);
index 273a6350d71edb3a29ab0acadfe37dadf493ef5e..d2add814d3787780f46b55eadf9e66d53380db72 100644 (file)
@@ -441,7 +441,7 @@ void FrameAssemblerV2::log_main_preamble(const ceph::bufferlist &bl)
     reinterpret_cast<const preamble_block_t*>(bl.front().c_str());
   logger().trace("{} SEND({}) frame: tag={}, num_segments={}, crc={}",
                  conn, bl.length(), (int)main_preamble->tag,
-                 (int)main_preamble->num_segments, main_preamble->crc);
+                 (int)main_preamble->num_segments, (uint32_t)main_preamble->crc);
 }
 
 FrameAssemblerV2Ref FrameAssemblerV2::create(SocketConnection &conn)
index 95b1e225034eb567b1bdf1a1107437d6ad84d2df..2c729f4e8c2d84fd0230f0bdf312227176f892ca 100644 (file)
@@ -290,7 +290,7 @@ Socket::connect(const entity_addr_t &peer_addr)
     auto ret = std::make_unique<Socket>(
       std::move(socket), side_t::connector, 0, construct_tag{});
     logger().debug("Socket::connect(): connected to {}, socket {}",
-                   peer_addr, fmt::ptr(ret));
+                   peer_addr, fmt::ptr(ret.get()));
     return ret;
   });
 }
@@ -431,7 +431,7 @@ ShardedServerSocket::accept(accept_func_t &&_fn_accept)
               peer_addr.get_port(), Socket::construct_tag{});
           logger().debug("ShardedServerSocket({})::accept(): accepted peer {}, "
                          "socket {}, dispatch_only_on_primary_sid = {}",
-                         ss.listen_addr, peer_addr, fmt::ptr(_socket),
+                         ss.listen_addr, peer_addr, fmt::ptr(_socket.get()),
                          ss.dispatch_only_on_primary_sid);
           std::ignore = seastar::with_gate(
               ss.shutdown_gate,
index 382d08f986ce94bf2cc1c8f38ea39d6a756d9d5a..7f442493c2a362935cdd2dfc127e470df6ff7366 100644 (file)
@@ -19,6 +19,7 @@
 #include <tuple>
 #include <boost/functional/hash.hpp>
 #include <fmt/os.h>
+#include <fmt/std.h>
 
 #include "auth/Auth.h"
 #include "Errors.h"
index b9b0339f9448add80baa11c5d455873e2ea3c97f..b93124f3c1269c11f149794489823fe64cf43174 100644 (file)
@@ -12,6 +12,7 @@
 #include "crimson/net/SocketMessenger.h"
 #include "msg/Message.h"
 #include "msg/msg_fmt.h"
+#include "include/utime_fmt.h"
 
 using namespace ceph::msgr::v2;
 using crimson::common::local_conf;
@@ -1018,10 +1019,10 @@ IOHandler::read_message(
                    msg_frame.front_len(),
                    msg_frame.middle_len(),
                    msg_frame.data_len(),
-                   current_header.type,
+                   (uint16_t)current_header.type,
                    conn.get_peer_name(),
-                   current_header.data_off,
-                   current_header.seq);
+                   (uint16_t)current_header.data_off,
+                   (uint32_t)current_header.seq);
 
     ceph_msg_header header{current_header.seq,
                            current_header.tid,
@@ -1088,7 +1089,7 @@ IOHandler::read_message(
       logger().debug("{} <== #{},{} === {} ({})",
                      conn,
                      message->get_seq(),
-                     current_header.ack_seq,
+                     (uint32_t)current_header.ack_seq,
                      *message,
                      message->get_type());
     }
index 8b88e2f5a254a469d4013854a4cf39ad52a932b0..80dd953c65fcbeebc78bd6e559cd7625da36ab6a 100644 (file)
@@ -541,7 +541,7 @@ struct fmt::formatter<crimson::net::io_handler_state> {
   }
 
   template <typename FormatContext>
-  auto format(crimson::net::io_handler_state state, FormatContext& ctx) {
+  auto format(crimson::net::io_handler_state state, FormatContext& ctx) const {
     return fmt::format_to(
         ctx.out(),
         "io(in_seq={}, is_out_queued={}, has_out_sent={})",
@@ -555,7 +555,7 @@ template <>
 struct fmt::formatter<crimson::net::IOHandler::io_state_t>
   : fmt::formatter<std::string_view> {
   template <typename FormatContext>
-  auto format(crimson::net::IOHandler::io_state_t state, FormatContext& ctx) {
+  auto format(crimson::net::IOHandler::io_state_t state, FormatContext& ctx) const {
     using enum crimson::net::IOHandler::io_state_t;
     std::string_view name;
     switch (state) {
index 27fc3e4a6ccf299afd3e50a77a866c44e2ff9fcc..adf8251b8a7c2acfb44e60023f6816ebf11a306b 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <fmt/format.h>
 #include <fmt/os.h>
+#include <fmt/std.h>
 
 #include "crimson/os/seastore/logging.h"
 #include "crimson/os/seastore/async_cleaner.h"
index 22c140b5993d948063150e1502227dd5f305b32e..6acb1df007786ce730a2364d9532344ca4ebe90f 100644 (file)
@@ -115,7 +115,7 @@ template <> struct fmt::formatter<crimson::os::seastore::onode::node_delta_op_t>
   using node_delta_op_t =  crimson::os::seastore::onode::node_delta_op_t;
   // parse is inherited from formatter<string_view>.
   template <typename FormatContext>
-  auto format(node_delta_op_t op, FormatContext& ctx) {
+  auto format(node_delta_op_t op, FormatContext& ctx) const {
     std::string_view name = "unknown";
     switch (op) {
     case node_delta_op_t::INSERT:
index 2cf67c90cbf49e6c877714d1073d7295cf5cf5f0..cc4c39d50270ed93a53e9fdcaf003a5df327ca96 100644 (file)
@@ -2485,7 +2485,7 @@ namespace fmt {
 // (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92944).
 template <HasDoFormatTo T> struct formatter<T> : formatter<std::string_view> {
   template <typename FormatContext>
-  auto format(const T& staged_iterator, FormatContext& ctx) {
+  auto format(const T& staged_iterator, FormatContext& ctx) const {
     return staged_iterator.do_format_to(ctx.out(), true);
   }
 };
index f0243bdb853b88c925410e8424aa1b78db70aff0..96b1436965fba7b19c01521d2a9892548097d9fc 100644 (file)
@@ -39,7 +39,7 @@ template <> struct fmt::formatter<crimson::os::seastore::op_type_t>
   using op_type_t =  crimson::os::seastore::op_type_t;
   // parse is inherited from formatter<string_view>.
   template <typename FormatContext>
-  auto format(op_type_t op, FormatContext& ctx) {
+  auto format(op_type_t op, FormatContext& ctx) const {
     std::string_view name = "unknown";
     switch (op) {
       case op_type_t::TRANSACTION:
@@ -1534,7 +1534,7 @@ SeaStore::Shard::_do_transaction_step(
 {
   LOG_PREFIX(SeaStore::Shard::_do_transaction_step);
   auto op = i.decode_op();
-  SUBTRACET(seastore_t, "got op {}", *ctx.transaction, op->op);
+  SUBTRACET(seastore_t, "got op {}", *ctx.transaction, (uint32_t)op->op);
 
   using ceph::os::Transaction;
   if (op->op == Transaction::OP_NOP)
index 0ab0531c7ad1dd20b032a0e0bd9b72372a8e39ac..0500271f81a6887fed5230ffb4b828bea04e45b2 100644 (file)
@@ -33,7 +33,7 @@ using segment_state_t = crimson::os::seastore::Segment::segment_state_t;
 template <> struct fmt::formatter<segment_state_t>: fmt::formatter<std::string_view> {
   // parse is inherited from formatter<string_view>.
   template <typename FormatContext>
-  auto format(segment_state_t s, FormatContext& ctx) {
+  auto format(segment_state_t s, FormatContext& ctx) const {
     std::string_view name = "unknown";
     switch (s) {
     case segment_state_t::EMPTY:
index 38bd199cfc9b2def7ebe86f7a607a8e00e99ba4c..df404014db0c94c0ef35ee4fd38bf5485556defa 100644 (file)
@@ -221,16 +221,6 @@ ScrubScan::ifut<> ScrubScan::scan_object(
 
 }
 
-struct obj_scrub_progress_t {
-  // nullopt once complete
-  std::optional<uint64_t> offset = 0;
-  ceph::buffer::hash data_hash{std::numeric_limits<uint32_t>::max()};
-
-  bool header_done = false;
-  std::optional<std::string> next_key;
-  bool keys_done = false;
-  ceph::buffer::hash omap_hash{std::numeric_limits<uint32_t>::max()};
-};
 ScrubScan::ifut<> ScrubScan::deep_scan_object(
   PG &pg,
   const ghobject_t &obj)
@@ -368,18 +358,3 @@ template class ScrubAsyncOpT<ScrubScan>;
 
 }
 
-template <>
-struct fmt::formatter<crimson::osd::obj_scrub_progress_t> {
-  constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
-  template <typename FormatContext>
-  auto format(const crimson::osd::obj_scrub_progress_t &progress,
-             FormatContext& ctx)
-  {
-    return fmt::format_to(
-      ctx.out(),
-      "obj_scrub_progress_t(offset: {}, "
-      "header_done: {}, next_key: {}, keys_done: {})",
-      progress.offset, progress.header_done,
-      progress.next_key, progress.keys_done);
-  }
-};
index 6aa7035d18562868e830567081ae4d8fc12d8852..02a5d852bb7c2e79784b48dfb2d3aa485a44c002 100644 (file)
@@ -260,6 +260,17 @@ protected:
   ifut<> run(PG &pg) final;
 };
 
+struct obj_scrub_progress_t {
+  // nullopt once complete
+  std::optional<uint64_t> offset = 0;
+  ceph::buffer::hash data_hash{std::numeric_limits<uint32_t>::max()};
+
+  bool header_done = false;
+  std::optional<std::string> next_key;
+  bool keys_done = false;
+  ceph::buffer::hash omap_hash{std::numeric_limits<uint32_t>::max()};
+};
+
 }
 
 namespace crimson {
@@ -280,6 +291,24 @@ struct EventBackendRegistry<osd::ScrubMessage> {
 
 }
 
+template <>
+struct fmt::formatter<crimson::osd::obj_scrub_progress_t> {
+  constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
+  template <typename FormatContext>
+  auto format(const crimson::osd::obj_scrub_progress_t &progress,
+             FormatContext& ctx) const
+  {
+    return fmt::format_to(
+      ctx.out(),
+      "obj_scrub_progress_t(offset: {}, "
+      "header_done: {}, next_key: {}, keys_done: {})",
+      progress.offset.has_value() ? *progress.offset : 0,
+      progress.header_done,
+      progress.next_key.has_value() ? *progress.next_key : "",
+      progress.keys_done);
+  }
+};
+
 #if FMT_VERSION >= 90000
 template <> struct fmt::formatter<crimson::osd::ScrubRequested>
   : fmt::ostream_formatter {};
index bb249b8e10e830927e60c5e739f529cdeff22937..1afbb7484ae76252fba9fd22094fc81cabfdb713 100644 (file)
@@ -13,6 +13,7 @@
 #include <boost/range/numeric.hpp>
 #include <fmt/format.h>
 #include <fmt/ostream.h>
+#include "include/utime_fmt.h"
 
 #include "common/hobject.h"
 
@@ -1515,7 +1516,8 @@ PG::interruptible_future<> PG::do_update_log_missing(
   if (m->pg_roll_forward_to != eversion_t())
     op_roll_forward_to = m->pg_roll_forward_to;
   logger().debug("op_trim_to = {}, op_roll_forward_to = {}",
-    op_trim_to, op_roll_forward_to);
+    op_trim_to.has_value() ? *op_trim_to : eversion_t(),
+    op_roll_forward_to.has_value() ? *op_roll_forward_to : eversion_t());
 
   peering_state.append_log_entries_update_missing(
     m->entries, t, op_trim_to, op_roll_forward_to);
index e065a004d24b2363febf86f2cba1b533f327e700..ea1e4f049811a9be1455a31c0802c3d24857f0dc 100644 (file)
@@ -10,6 +10,7 @@
 #include <boost/range/algorithm/copy.hpp>
 #include <fmt/format.h>
 #include <fmt/ostream.h>
+#include "include/utime_fmt.h"
 #include <seastar/core/print.hh>
 
 #include "messages/MOSDOp.h"
@@ -298,7 +299,7 @@ PGBackend::sparse_read(const ObjectState& os, OSDOp& osd_op,
     adjusted_length = adjusted_size - offset;
   }
   logger().trace("sparse_read: {} {}~{}",
-                 os.oi.soid, op.extent.offset, op.extent.length);
+                 os.oi.soid, (uint64_t)op.extent.offset, (uint64_t)op.extent.length);
   return interruptor::make_interruptible(store->fiemap(coll, ghobject_t{os.oi.soid},
     offset, adjusted_length)).safe_then_interruptible(
     [&delta_stats, &os, &osd_op, this](auto&& m) {
@@ -313,7 +314,7 @@ PGBackend::sparse_read(const ObjectState& os, OSDOp& osd_op,
           ceph::encode(extents, osd_op.outdata);
           encode_destructively(bl, osd_op.outdata);
           logger().trace("sparse_read got {} bytes from object {}",
-                         osd_op.op.extent.length, os.oi.soid);
+                         (uint64_t)osd_op.op.extent.length, os.oi.soid);
          delta_stats.num_rd++;
          delta_stats.num_rd_kb += shift_round_up(osd_op.op.extent.length, 10);
           return read_errorator::make_ready_future<>();
@@ -395,7 +396,7 @@ PGBackend::checksum(const ObjectState& os, OSDOp& osd_op)
     auto& checksum = osd_op.op.checksum;
     if (read_bl.length() != checksum.length) {
       logger().warn("checksum: bytes read {} != {}",
-                        read_bl.length(), checksum.length);
+                        read_bl.length(), (uint64_t)checksum.length);
       return crimson::ct_error::invarg::make();
     }
     // calculate its checksum and put the result in outdata
index 1148585ad25f3d4d2791114ad210d6ac7e351155..8f844dc8021506559ed55dea1ba7ff16405f6bd8 100644 (file)
@@ -370,6 +370,6 @@ RecoveryBackend::handle_recovery_op(
   default:
     return seastar::make_exception_future<>(
        std::invalid_argument(fmt::format("invalid request type: {}",
-                                         m->get_header().type)));
+                                         (uint16_t)m->get_header().type)));
   }
 }
index 2d528e04d4bd915854574b685c27f9cf888c4d1d..d1cc5ef4713947d42e34cfb486e10cf08d4743bf 100644 (file)
@@ -141,7 +141,7 @@ struct fmt::formatter<crimson::osd::scrub::blocked_range_t> {
   constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
 
   template <typename FormatContext>
-  auto format(const auto &range, FormatContext& ctx)
+  auto format(const auto &range, FormatContext& ctx) const
   {
     return fmt::format_to(
       ctx.out(),
index 088054c5a6ed6fc4c5b38eea1c4a7c9daa7b1273..6fb9bf43cfb60915a7e7132216fa5e18bf6f9c20 100644 (file)
@@ -81,7 +81,7 @@ Watch::~Watch()
 seastar::future<> Watch::connect(crimson::net::ConnectionXcoreRef conn, bool)
 {
   if (this->conn == conn) {
-    logger().debug("conn={} already connected", conn);
+    logger().debug("conn={} already connected", *conn);
     return seastar::now();
   }
   timeout_timer.cancel();