From: Patrick Donnelly Date: Wed, 23 Oct 2024 16:32:55 +0000 (-0400) Subject: client: print dentry with alternate_name on dump X-Git-Tag: v19.2.3~288^2~56 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bfe08312602252bd00fdb381722bb6d1f60b1975;p=ceph.git client: print dentry with alternate_name on dump Signed-off-by: Patrick Donnelly Fixes: https://tracker.ceph.com/issues/66373 (cherry picked from commit 5c0fa1128c446a4737347dfaa100e802f3ff7ebe) --- diff --git a/src/client/Dentry.cc b/src/client/Dentry.cc index 70675599210..0cfb1db2198 100644 --- a/src/client/Dentry.cc +++ b/src/client/Dentry.cc @@ -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) diff --git a/src/client/Dentry.h b/src/client/Dentry.h index 47d320ecbbc..745c6115742 100644 --- a/src/client/Dentry.h +++ b/src/client/Dentry.h @@ -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;