MCPcopy Create free account
hub / github.com/ceph/ceph / command_dump_tree

Method command_dump_tree

src/mds/MDSRank.cc:3315–3350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3313}
3314
3315void MDSRank::command_dump_tree(const cmdmap_t &cmdmap, std::ostream &ss, Formatter *f)
3316{
3317 std::string path;
3318 cmd_getval(cmdmap, "path", path);
3319 std::string root;
3320 cmd_getval(cmdmap, "root", root);
3321 int64_t depth;
3322 if (!cmd_getval(cmdmap, "depth", depth)) {
3323 depth = -1;
3324 }
3325 if (root.empty()) {
3326 root = "/";
3327 }
3328
3329 auto dump = [&](Formatter *f) {
3330 std::lock_guard l(mds_lock);
3331 CInode *in = mdcache->cache_traverse(filepath(root.c_str()));
3332 if (!in) {
3333 ss << "inode for path '" << filepath(root.c_str()) << "' is not in cache";
3334 return;
3335 }
3336 f->open_array_section("inodes");
3337 mdcache->dump_tree(in, 0, depth, f);
3338 f->close_section();
3339 };
3340
3341 if (!path.empty()) {
3342 auto ff = JSONFormatterFile(path, false);
3343 dump(&ff);
3344 f->open_object_section("result");
3345 f->dump_string("path", path);
3346 f->close_section();
3347 } else {
3348 dump(f);
3349 }
3350}
3351
3352CDir *MDSRank::_command_dirfrag_get(
3353 const cmdmap_t &cmdmap,

Callers

nothing calls this directly

Calls 12

JSONFormatterFileClass · 0.85
cache_traverseMethod · 0.80
filepathClass · 0.70
cmd_getvalFunction · 0.50
dumpFunction · 0.50
emptyMethod · 0.45
c_strMethod · 0.45
open_array_sectionMethod · 0.45
dump_treeMethod · 0.45
close_sectionMethod · 0.45
open_object_sectionMethod · 0.45
dump_stringMethod · 0.45

Tested by

no test coverage detected