]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os: print pointer using fmt::ptr()
authorKefu Chai <tchaikov@gmail.com>
Tue, 22 Nov 2022 12:36:30 +0000 (20:36 +0800)
committerKefu Chai <tchaikov@gmail.com>
Tue, 22 Nov 2022 14:57:18 +0000 (22:57 +0800)
also, partial specialize fmt::format<> for boost::instrusive_ptr<>,
so we can use fmt::ptr() to print boost::intrusive_ptr<>, just like
how we print std::shared_ptr<>.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/crimson/os/seastore/onode_manager/staged-fltree/node.cc

index 5e44f471fd18f4cd9ae94d75a827d5987db3d100..6f08f4d3c48532bfac5fa643ef72bbfd26548e17 100644 (file)
 
 SET_SUBSYS(seastore_onode);
 
+namespace fmt {
+template <typename T>
+const void* ptr(const ::boost::intrusive_ptr<T>& p) {
+  return p.get();
+}
+}
+
 namespace crimson::os::seastore::onode {
 /*
  * tree_cursor_t
@@ -717,13 +724,13 @@ eagain_ifuture<Ref<Node>> Node::load(
     if (!field_type) {
       ERRORT("load addr={:x}, is_level_tail={} error, "
              "got invalid header -- {}",
-             c.t, addr, expect_is_level_tail, extent);
+             c.t, addr, expect_is_level_tail, fmt::ptr(extent));
       ceph_abort("fatal error");
     }
     if (header.get_is_level_tail() != expect_is_level_tail) {
       ERRORT("load addr={:x}, is_level_tail={} error, "
              "is_level_tail mismatch -- {}",
-             c.t, addr, expect_is_level_tail, extent);
+             c.t, addr, expect_is_level_tail, fmt::ptr(extent));
       ceph_abort("fatal error");
     }
 
@@ -732,7 +739,7 @@ eagain_ifuture<Ref<Node>> Node::load(
       if (extent->get_length() != c.vb.get_leaf_node_size()) {
         ERRORT("load addr={:x}, is_level_tail={} error, "
                "leaf length mismatch -- {}",
-               c.t, addr, expect_is_level_tail, extent);
+               c.t, addr, expect_is_level_tail, fmt::ptr(extent));
         ceph_abort("fatal error");
       }
       auto impl = LeafNodeImpl::load(extent, *field_type);
@@ -743,7 +750,7 @@ eagain_ifuture<Ref<Node>> Node::load(
       if (extent->get_length() != c.vb.get_internal_node_size()) {
         ERRORT("load addr={:x}, is_level_tail={} error, "
                "internal length mismatch -- {}",
-               c.t, addr, expect_is_level_tail, extent);
+               c.t, addr, expect_is_level_tail, fmt::ptr(extent));
         ceph_abort("fatal error");
       }
       auto impl = InternalNodeImpl::load(extent, *field_type);