}
}
+bool MDCache::dump_inode(Formatter *f, uint64_t number) {
+ CInode *in = get_inode(number);
+ if (!in) {
+ return false;
+ }
+ f->open_object_section("inode");
+ in->dump(f, CInode::DUMP_DEFAULT | CInode::DUMP_PATH);
+ f->close_section();
+ return true;
+}
void clean_open_file_lists();
void dump_openfiles(Formatter *f);
+ bool dump_inode(Formatter *f, uint64_t number);
protected:
// [rejoin]
bool rejoins_pending;
asok_hook,
"List the opening files and their caps");
assert(r == 0);
+ r = admin_socket->register_command("dump inode",
+ "dump inode "
+ "name=number,type=CephInt,req=true",
+ asok_hook,
+ "dump inode by inode number");
+ assert(r == 0);
}
void MDSDaemon::clean_up_admin_socket()
command_dirfrag_ls(cmdmap, ss, f);
} else if (command == "openfiles ls") {
command_openfiles_ls(f);
+ } else if (command == "dump inode") {
+ command_dump_inode(f, cmdmap, ss);
} else {
return false;
}
mdcache->dump_openfiles(f);
}
+void MDSRank::command_dump_inode(Formatter *f, const cmdmap_t &cmdmap, std::ostream &ss)
+{
+ Mutex::Locker l(mds_lock);
+ int64_t number;
+ bool got = cmd_getval(g_ceph_context, cmdmap, "number", number);
+ if (!got) {
+ ss << "missing inode number";
+ return;
+ }
+
+ bool success = mdcache->dump_inode(f, number);
+ if (!success) {
+ ss << "dump inode failed, wrong inode number or the inode is not cached";
+ }
+}
+
void MDSRank::dump_status(Formatter *f) const
{
if (state == MDSMap::STATE_REPLAY ||
std::ostream &ss);
void command_openfiles_ls(Formatter *f);
void command_dump_tree(const cmdmap_t &cmdmap, std::ostream &ss, Formatter *f);
+ void command_dump_inode(Formatter *f, const cmdmap_t &cmdmap, std::ostream &ss);
protected:
Messenger *messenger;