Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mds: replace C_VoidFn in MDSDaemon with lambdas #13465

Merged
merged 1 commit into from
Feb 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions src/mds/MDSDaemon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,6 @@
#undef dout_prefix
#define dout_prefix *_dout << "mds." << name << ' '

/**
* Helper for simple callbacks that call a void fn with no args.
*/
class C_VoidFn : public Context
{
typedef void (MDSDaemon::*fn_ptr)();
protected:
MDSDaemon *mds;
fn_ptr fn;
public:
C_VoidFn(MDSDaemon *mds_, fn_ptr fn_)
: mds(mds_), fn(fn_)
{
assert(mds_);
assert(fn_);
}

void finish(int r) override
{
(mds->*fn)();
}
};

class MDSDaemon::C_MDS_Tick : public Context {
protected:
Expand Down Expand Up @@ -997,8 +975,8 @@ void MDSDaemon::handle_mds_map(MMDSMap *m)
if (mds_rank == NULL) {
mds_rank = new MDSRankDispatcher(whoami, mds_lock, clog,
timer, beacon, mdsmap, messenger, monc,
new C_VoidFn(this, &MDSDaemon::respawn),
new C_VoidFn(this, &MDSDaemon::suicide));
new FunctionContext([this](int r){respawn();}),
new FunctionContext([this](int r){suicide();}));
dout(10) << __func__ << ": initializing MDS rank "
<< mds_rank->get_nodeid() << dendl;
mds_rank->init();
Expand Down