From: Ronen Friedman Date: Sat, 3 Aug 2024 12:45:02 +0000 (-0500) Subject: osd: fix scrub_backend formatters X-Git-Tag: v20.0.0~1231^2~7 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0e8da23041358beb732b38f051b95d4ed9a48cf0;p=ceph.git osd: fix scrub_backend formatters Adding missing 'const', and placing in the fmt namespace. Signed-off-by: Ronen Friedman --- diff --git a/src/osd/scrubber/scrub_backend.h b/src/osd/scrubber/scrub_backend.h index ffb41c27e37ba..1755d6a824624 100644 --- a/src/osd/scrubber/scrub_backend.h +++ b/src/osd/scrubber/scrub_backend.h @@ -164,9 +164,10 @@ struct shard_as_auth_t { // other in/out arguments) via this struct }; +namespace fmt { // the format specifier {D} is used to request debug output template <> -struct fmt::formatter { +struct formatter { template constexpr auto parse(ParseContext& ctx) { @@ -177,7 +178,7 @@ struct fmt::formatter { return it; } template - auto format(shard_as_auth_t const& as_auth, FormatContext& ctx) + auto format(shard_as_auth_t const& as_auth, FormatContext& ctx) const { if (debug_log) { // note: 'if' chain, as hard to consistently (on all compilers) avoid some @@ -208,6 +209,7 @@ struct fmt::formatter { bool debug_log{false}; }; +} // namespace fmt struct auth_selection_t { shard_to_scrubmap_t::iterator auth; ///< an iter into one of this_chunk->maps @@ -229,7 +231,7 @@ struct fmt::formatter { } template - auto format(auth_selection_t const& aus, FormatContext& ctx) + auto format(auth_selection_t const& aus, FormatContext& ctx) const { return fmt::format_to(ctx.out(), " {{AU-S: {}->{:x} OI({:x}:{}) {} dm:{}}} ", @@ -517,12 +519,14 @@ class ScrubBackend { uint64_t logical_to_ondisk_size(uint64_t logical_size) const; }; +namespace fmt { + template <> -struct fmt::formatter { +struct formatter { constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } template - auto format(const data_omap_digests_t& dg, FormatContext& ctx) + auto format(const data_omap_digests_t& dg, FormatContext& ctx) const { // can't use value_or() due to different output types if (std::get<0>(dg).has_value()) { @@ -539,7 +543,7 @@ struct fmt::formatter { }; template <> -struct fmt::formatter> { +struct formatter> { constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } template @@ -552,3 +556,4 @@ struct fmt::formatter> { std::get<1>(x)); } }; +} // namespace fmt