From: Patrick Donnelly Date: Thu, 13 Nov 2025 19:47:24 +0000 (-0500) Subject: common: simplify fragment printing X-Git-Tag: testing/wip-pdonnell-testing-20260323.122957-tentacle~351 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ced59f0bd65ff8e3352615fe3b00d212514eced7;p=ceph-ci.git common: simplify fragment printing Fixes: https://tracker.ceph.com/issues/73792 Signed-off-by: Patrick Donnelly (cherry picked from commit a8bb5a891eef8aae11e7748f71eac666732f3cff) Resolves: rhbz#2414841 --- diff --git a/src/common/frag.cc b/src/common/frag.cc index 13a8e154559..452f30ff5dc 100644 --- a/src/common/frag.cc +++ b/src/common/frag.cc @@ -17,6 +17,8 @@ #include "common/debug.h" #include "common/Formatter.h" +#include + #include #include @@ -52,13 +54,12 @@ void frag_t::generate_test_instances(std::list& ls) { std::ostream& operator<<(std::ostream& out, const frag_t& hb) { //out << std::hex << hb.value() << std::dec << "/" << hb.bits() << '='; - unsigned num = hb.bits(); - if (num) { - unsigned val = hb.value(); - for (unsigned bit = 23; num; num--, bit--) - out << ((val & (1< 0) { + auto v = hb.value() >> hb.mask_shift(); + return out << fmt::format("{0:0{1}b}*", v, b); + } else { + return out << '*'; } - return out << '*'; } bool fragtree_t::force_to_leaf(CephContext *cct, frag_t x) {