]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: print dentry with alternate_name on dump
authorPatrick Donnelly <pdonnell@ibm.com>
Wed, 23 Oct 2024 16:32:55 +0000 (12:32 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Mon, 17 Mar 2025 19:43:17 +0000 (15:43 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
Fixes: https://tracker.ceph.com/issues/66373
(cherry picked from commit 5c0fa1128c446a4737347dfaa100e802f3ff7ebe)

src/client/Dentry.cc
src/client/Dentry.h

index 70675599210ab1509c57bedf35d18b7e9694335a..0cfb1db21987da42bc039fc706d13ce0354a7fe7 100644 (file)
@@ -9,6 +9,7 @@
 #include "Inode.h"
 
 #include "common/Formatter.h"
+#include "common/strescape.h"
 
 void Dentry::dump(Formatter *f) const
 {
@@ -27,9 +28,25 @@ void Dentry::dump(Formatter *f) const
   f->dump_int("cap_shared_gen", cap_shared_gen);
 }
 
-std::ostream &operator<<(std::ostream &oss, const Dentry &dn)
+void Dentry::print(std::ostream& os) const
 {
-  return oss << dn.dir->parent_inode->vino() << "[\"" << dn.name << "\"]";
+  os << dir->parent_inode->vino();
+  os << "[";
+  os << "\"" << binstrprint(name) << "\"";
+  if (!alternate_name.empty()) {
+    os << " altn=\"" << binstrprint(alternate_name, 16) << "\"";
+  }
+  os << " ref=" << ref;
+  if (inode) {
+    os << " ino=" << inode->vino();
+  } else {
+    os << " ino=nil";
+  }
+  os << " csg=" << cap_shared_gen;
+  if (is_renaming) {
+    os << " is_renaming=true";
+  }
+  os << "]";
 }
 
 void intrusive_ptr_add_ref(Dentry* dn)
index 47d320ecbbcf7deaaf5a6c86db72330a2655a63c..745c611574261ca1bd8d677d6437dea3974cb08d 100644 (file)
@@ -94,7 +94,7 @@ public:
   }
 
   void dump(Formatter *f) const;
-  friend std::ostream &operator<<(std::ostream &oss, const Dentry &Dentry);
+  void print(std::ostream&) const;
 
   Dir     *dir;
   const std::string name;