#undef dout_prefix
#define dout_prefix *_dout << "mds." << name << ' '
-
-class MDSDaemon::C_MDS_Tick : public Context {
- protected:
- MDSDaemon *mds_daemon;
-public:
- explicit C_MDS_Tick(MDSDaemon *m) : mds_daemon(m) {}
- void finish(int r) override {
- assert(mds_daemon->mds_lock.is_locked_by_me());
- mds_daemon->tick();
- }
-};
-
// cons/des
MDSDaemon::MDSDaemon(const std::string &n, Messenger *m, MonClient *mc) :
Dispatcher(m->cct),
mgrc(m->cct, m),
log_client(m->cct, messenger, &mc->monmap, LogClient::NO_FLAGS),
mds_rank(NULL),
- tick_event(0),
asok_hook(NULL)
{
orig_argc = 0;
asok_hook,
"dump metadata cache (optionally to a file)");
assert(r == 0);
+ r = admin_socket->register_command("cache status",
+ "cache status",
+ asok_hook,
+ "show cache status");
+ assert(r == 0);
r = admin_socket->register_command("dump tree",
"dump tree "
"name=root,type=CephString,req=true "
admin_socket->unregister_command("flush_path");
admin_socket->unregister_command("export dir");
admin_socket->unregister_command("dump cache");
+ admin_socket->unregister_command("cache status");
admin_socket->unregister_command("dump tree");
admin_socket->unregister_command("session evict");
admin_socket->unregister_command("osdmap barrier");
if (tick_event) timer.cancel_event(tick_event);
// schedule
- tick_event = new C_MDS_Tick(this);
- timer.add_event_after(g_conf->mds_tick_interval, tick_event);
+ tick_event = timer.add_event_after(
+ g_conf->mds_tick_interval,
+ new FunctionContext([this](int) {
+ assert(mds_lock.is_locked_by_me());
+ tick();
+ }));
}
void MDSDaemon::tick()
cpu_profiler_handle_command(argvec, ds);
} else {
// Give MDSRank a shot at the command
- if (mds_rank) {
+ if (!mds_rank) {
+ ss << "MDS not active";
+ r = -EINVAL;
+ }
+ else {
bool handled = mds_rank->handle_command(cmdmap, m, &r, &ds, &ss,
need_reply);
- if (handled) {
- goto out;
+ if (!handled) {
+ // MDSDaemon doesn't know this command
+ ss << "unrecognized command! " << prefix;
+ r = -EINVAL;
}
}
-
- // Neither MDSDaemon nor MDSRank know this command
- std::ostringstream ss;
- ss << "unrecognized command! " << prefix;
- r = -EINVAL;
}
out: