From f292d110fd53c3c95c26bcfd9c36dfbe87644870 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Mon, 22 Sep 2025 00:39:24 +0530 Subject: [PATCH] DMM: mds dont gen path Signed-off-by: Rishabh Dave --- src/mds/CDir.cc | 20 +++++++++++++------- src/mds/CDir.h | 2 +- src/mds/CInode.cc | 4 ++-- src/mds/Server.cc | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 321d059af71..001221a5a03 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -91,7 +91,7 @@ public: ostream& operator<<(ostream& out, const CDir& dir) { - out << "[dir " << dir.dirfrag() << " " << dir.get_path() << "/" + out << "[dir " << dir.dirfrag() << " " << dir.get_path(true) << "/" << " [" << dir.first << ",head]"; if (dir.is_auth()) { out << " auth"; @@ -2245,7 +2245,7 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map& omap, dout(0) << "_fetched missing object for " << *this << dendl; clog->error() << "dir " << dirfrag() << " object missing on disk; some " - "files may be lost (" << get_path() << ")"; + "files may be lost (" << get_path(true) << ")"; go_bad(complete); return; @@ -2260,14 +2260,14 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map& omap, derr << "Corrupt fnode in dirfrag " << dirfrag() << ": " << err.what() << dendl; clog->warn() << "Corrupt fnode header in " << dirfrag() << ": " - << err.what() << " (" << get_path() << ")"; + << err.what() << " (" << get_path(true) << ")"; go_bad(complete); return; } if (!p.end()) { clog->warn() << "header buffer of dir " << dirfrag() << " has " << hdrbl.length() - p.get_off() << " extra bytes (" - << get_path() << ")"; + << get_path(true) << ")"; go_bad(complete); return; } @@ -2385,7 +2385,7 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map& omap, } catch (const buffer::error &err) { mdcache->mds->clog->warn() << "Corrupt dentry '" << key.name << "' in " "dir frag " << dirfrag() << ": " - << err.what() << "(" << get_path() << ")"; + << err.what() << "(" << get_path(true) << ")"; // Remember that this dentry is damaged. Subsequent operations // that try to act directly on it will get their EIOs, but this @@ -4057,10 +4057,16 @@ bool CDir::scrub_local() return good; } -std::string CDir::get_path() const +std::string CDir::get_path(bool trim_path) const { std::string path; - get_inode()->make_path_string(path, true); + + if (trim_path) { + get_inode()->make_path_string(path, true, NULL, 10); + } else { + get_inode()->make_path_string(path, true); + } + return path; } diff --git a/src/mds/CDir.h b/src/mds/CDir.h index 34eeb3a8a82..b91d570b56d 100644 --- a/src/mds/CDir.h +++ b/src/mds/CDir.h @@ -786,7 +786,7 @@ private: void steal_dentry(CDentry *dn); // from another dir. used by merge/split. void finish_old_fragment(std::vector& waiters, bool replay); void init_fragment_pins(); - std::string get_path() const; + std::string get_path(bool trim_path=false) const; // -- authority -- /* diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index 94e1dde89a9..a7970a6c3ee 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -2719,7 +2719,7 @@ void CInode::finish_scatter_gather_update(int type, MutationRef& mut) if (pi->dirstat.nfiles < 0 || pi->dirstat.nsubdirs < 0) { std::string path; - make_path_string(path); + make_path_string(path, false, NULL, 10); clog->error() << "Inconsistent statistics detected: fragstat on inode " << ino() << " (" << path << "), inode has " << pi->dirstat; ceph_assert(!"bad/negative fragstat" == g_conf()->mds_verify_scatter); @@ -5024,7 +5024,7 @@ next: if (!results->backtrace.passed && in->scrub_infop->header->get_repair()) { std::string path; - in->make_path_string(path); + in->make_path_string(path, false, NULL, 10); in->mdcache->mds->clog->warn() << "bad backtrace on inode " << in->ino() << "(" << path << "), rewriting it"; in->mark_dirty_parent(in->mdcache->mds->mdlog->get_current_segment(), diff --git a/src/mds/Server.cc b/src/mds/Server.cc index fdfd5d3e08a..069d625c84c 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -9226,7 +9226,7 @@ void Server::_rmdir_rollback_finish(const MDRequestRef& mdr, metareqid_t reqid, */ bool Server::_dir_is_nonempty_unlocked(const MDRequestRef& mdr, CInode *in) { - dout(10) << "dir_is_nonempty_unlocked " << *in << dendl; + dout(10) << "_dir_is_nonempty_unlocked " << *in << dendl; ceph_assert(in->is_auth()); if (in->filelock.is_cached()) -- 2.39.5