show_func(p.second);
}
-int MDCache::cache_status(Formatter *f)
+void MDCache::cache_status(Formatter *f)
{
f->open_object_section("cache");
f->close_section();
f->close_section();
- return 0;
}
void MDCache::dump_tree(CInode *in, const int cur_depth, const int max_depth, Formatter *f)
int dump_cache(Formatter *f);
void dump_tree(CInode *in, const int cur_depth, const int max_depth, Formatter *f);
- int cache_status(Formatter *f);
+ void cache_status(Formatter *f);
void dump_resolve_status(Formatter *f) const;
void dump_rejoin_status(Formatter *f) const;
}
} else if (command == "cache status") {
Mutex::Locker l(mds_lock);
- int r = mdcache->cache_status(f);
- if (r != 0) {
- ss << "Failed to get cache status: " << cpp_strerror(r);
- }
+ mdcache->cache_status(f);
} else if (command == "dump tree") {
command_dump_tree(cmdmap, ss, f);
} else if (command == "dump loads") {
return true;
}
- Formatter *f = new JSONFormatter(true);
- dump_sessions(filter, f);
- f->flush(*ds);
- delete f;
+ JSONFormatter f(true);
+ dump_sessions(filter, &f);
+ f.flush(*ds);
return true;
} else if (prefix == "session evict" || prefix == "client evict") {
std::vector<std::string> filter_args;
*need_reply = false;
return true;
} else if (prefix == "damage ls") {
- Formatter *f = new JSONFormatter(true);
- damage_table.dump(f);
- f->flush(*ds);
- delete f;
+ JSONFormatter f(true);
+ damage_table.dump(&f);
+ f.flush(*ds);
return true;
} else if (prefix == "damage rm") {
damage_entry_id_t id = 0;