]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: formatter for pg_log_op_return_item_t
authorRonen Friedman <rfriedma@redhat.com>
Fri, 4 Aug 2023 16:11:18 +0000 (11:11 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Tue, 15 Aug 2023 12:32:46 +0000 (07:32 -0500)
Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/osd_types.h
src/osd/osd_types_fmt.h

index 8f99cdfbdf6aecc189fc320f05383bb944e42b82..b258eeb944e08d4e480991042fb73eabe4c91679 100644 (file)
@@ -4223,6 +4223,16 @@ struct pg_log_op_return_item_t {
   }
 };
 WRITE_CLASS_ENCODER(pg_log_op_return_item_t)
+namespace fmt {
+template <>
+struct formatter<pg_log_op_return_item_t> {
+  constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); }
+  template <typename FormatContext>
+  auto format(const pg_log_op_return_item_t& litm, FormatContext& ctx) const {
+    return fmt::format_to(ctx.out(), "r={}+{}b", litm.rval, litm.bl.length());
+  }
+};
+} // namespace fmt
 
 /**
  * pg_log_entry_t - single entry/event in pg log
index 729baf01a57f61709b3ecba0026a6d29cf2ece33..c10877cf3aab6903bcde181a62c70b3a88a4c384 100644 (file)
@@ -329,7 +329,6 @@ struct fmt::formatter<ScrubMap> {
 };
 
 #if FMT_VERSION >= 90000
-template <> struct fmt::formatter<pg_log_op_return_item_t> : fmt::ostream_formatter {};
 template <> struct fmt::formatter<watch_info_t> : fmt::ostream_formatter {};
 template <bool TrackChanges> struct fmt::formatter<pg_missing_set<TrackChanges>> : fmt::ostream_formatter {};
 #endif