From 153aa2027bba2bfbb879661640166af19cf2a6b7 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Wed, 5 Nov 2014 14:23:32 -0800 Subject: [PATCH] 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 --- src/mds/MDSContinuation.h | 35 +++++++++++++++++++++++++++++++++++ src/mds/Makefile.am | 3 ++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/mds/MDSContinuation.h diff --git a/src/mds/MDSContinuation.h b/src/mds/MDSContinuation.h new file mode 100644 index 00000000000..82d178fc0cd --- /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 71f76d5c010..a0dadc9aa5a 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 \ -- 2.47.3