ostream& operator<<(ostream& out, const CDir& dir)
{
- string path;
- dir.get_inode()->make_path_string_projected(path);
- out << "[dir " << dir.dirfrag() << " " << path << "/"
+ out << "[dir " << dir.dirfrag() << " " << dir.get_path() << "/"
<< " [" << dir.first << ",head]";
if (dir.is_auth()) {
out << " auth";
}
dout(0) << "_fetched missing object for " << *this << dendl;
- clog->error() << "dir " << dirfrag() << " object missing on disk; some files may be lost\n";
+
+ clog->error() << "dir " << dirfrag() << " object missing on disk; some "
+ "files may be lost (" << get_path() << ")";
go_bad();
return;
derr << "Corrupt fnode in dirfrag " << dirfrag()
<< ": " << err << dendl;
clog->warn() << "Corrupt fnode header in " << dirfrag() << ": "
- << err;
+ << err << " (" << get_path() << ")";
go_bad();
return;
}
if (!p.end()) {
clog->warn() << "header buffer of dir " << dirfrag() << " has "
- << hdrbl.length() - p.get_off() << " extra bytes\n";
+ << hdrbl.length() - p.get_off() << " extra bytes ("
+ << get_path() << ")";
go_bad();
return;
}
} catch (const buffer::error &err) {
cache->mds->clog->warn() << "Corrupt dentry '" << dname << "' in "
"dir frag " << dirfrag() << ": "
- << err;
+ << err << "(" << get_path() << ")";
// Remember that this dentry is damaged. Subsequent operations
// that try to act directly on it will get their EIOs, but this
{
assert(f != NULL);
- string path;
- get_inode()->make_path_string_projected(path);
- f->dump_stream("path") << path;
+ f->dump_stream("path") << get_path();
f->dump_stream("dirfrag") << dirfrag();
f->dump_int("snapid_first", first);
}
return rval;
}
+
+std::string CDir::get_path() const
+{
+ std::string path;
+ get_inode()->make_path_string_projected(path);
+ return path;
+}
+
ostream& operator<<(ostream& out, const class CDir& dir);
class CDir : public MDSCacheObject {
+ friend ostream& operator<<(ostream& out, const class CDir& dir);
+
/*
* This class uses a boost::pool to handle allocation. This is *not*
* thread-safe, so don't do allocations from multiple threads!
*/
mds_authority_t dir_auth;
+ std::string get_path() const;
+
public:
mds_authority_t authority() const;
mds_authority_t get_dir_auth() const { return dir_auth; }