From: Greg Farnum Date: Wed, 5 Nov 2014 22:23:32 +0000 (-0800) Subject: Rebase: MDS: Add an MDSContinuation for ease of use X-Git-Tag: v0.89~50^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=153aa2027bba2bfbb879661640166af19cf2a6b7;p=ceph.git Rebase: MDS: Add an MDSContinuation for ease of use Unlike the regular Continuation, this one works in terms of an MDRequest and has wrappers to provide Context callbacks that are either internal MDS or IO appropriate. Signed-off-by: Greg Farnum --- diff --git a/src/mds/MDSContinuation.h b/src/mds/MDSContinuation.h new file mode 100644 index 000000000000..82d178fc0cd9 --- /dev/null +++ b/src/mds/MDSContinuation.h @@ -0,0 +1,35 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2014 Red Hat + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#include "common/Continuation.h" +#include "mds/Mutation.h" +#include "mds/Server.h" + +class MDSContinuation : public Continuation { + MDRequestRef mdr; + Server *server; +public: + MDSContinuation(MDRequestRef& mdrequest, Server *s) : + Continuation(NULL), mdr(mdrequest), server(s) {} +protected: + void _done() { + server->respond_to_request(mdr, get_rval()); + } + MDSInternalContextBase *get_internal_callback(int stage) { + return new MDSInternalContextWrapper(server->mds, get_callback(stage)); + } + MDSIOContextBase *get_io_callback(int stage) { + return new MDSIOContextWrapper(server->mds, get_callback(stage)); + } +}; diff --git a/src/mds/Makefile.am b/src/mds/Makefile.am index 71f76d5c010a..a0dadc9aa5ac 100644 --- a/src/mds/Makefile.am +++ b/src/mds/Makefile.am @@ -69,7 +69,8 @@ noinst_HEADERS += \ mds/inode_backtrace.h \ mds/mds_table_types.h \ mds/mdstypes.h \ - mds/snap.h + mds/snap.h \ + mds/MDSContinuation.h noinst_HEADERS += \ mds/events/ECommitted.h \