]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: refactor MDSContext inheritance 26123/head
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 23 Jan 2019 00:54:14 +0000 (16:54 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Sat, 2 Feb 2019 00:38:57 +0000 (16:38 -0800)
This commit greatly simplifies things.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
45 files changed:
src/mds/CDentry.cc
src/mds/CDentry.h
src/mds/CDir.cc
src/mds/CDir.h
src/mds/CInode.cc
src/mds/CInode.h
src/mds/Locker.cc
src/mds/Locker.h
src/mds/LogSegment.h
src/mds/MDCache.cc
src/mds/MDCache.h
src/mds/MDLog.cc
src/mds/MDLog.h
src/mds/MDSCacheObject.cc
src/mds/MDSCacheObject.h
src/mds/MDSContext.cc
src/mds/MDSContext.h
src/mds/MDSContinuation.h
src/mds/MDSRank.cc
src/mds/MDSRank.h
src/mds/MDSTable.cc
src/mds/MDSTable.h
src/mds/MDSTableClient.cc
src/mds/MDSTableClient.h
src/mds/MDSTableServer.cc
src/mds/MDSTableServer.h
src/mds/Migrator.cc
src/mds/Migrator.h
src/mds/Mutation.h
src/mds/OpenFileTable.cc
src/mds/OpenFileTable.h
src/mds/ScatterLock.h
src/mds/ScrubStack.cc
src/mds/ScrubStack.h
src/mds/Server.cc
src/mds/Server.h
src/mds/SessionMap.cc
src/mds/SessionMap.h
src/mds/SimpleLock.h
src/mds/SnapClient.cc
src/mds/SnapClient.h
src/mds/SnapRealm.cc
src/mds/SnapRealm.h
src/mds/StrayManager.cc
src/mds/journal.cc

index bfd9e88b92728fb01d47be4d6ae86c39334fcfcd..b2a7db1e78ce7e3dbbb21fec7f1d6aba45eb8325 100644 (file)
@@ -147,7 +147,7 @@ mds_authority_t CDentry::authority() const
 }
 
 
-void CDentry::add_waiter(uint64_t tag, MDSInternalContextBase *c)
+void CDentry::add_waiter(uint64_t tag, MDSContext *c)
 {
   // wait on the directory?
   if (tag & (WAIT_UNFREEZE|WAIT_SINGLEAUTH)) {
index 2fb75277e119556e9d50edf480202a90bbe204f0..16923d83f77fbcebc22fc789fb0a44de34a98b3f 100644 (file)
@@ -137,7 +137,7 @@ public:
   // -- wait --
   //static const int WAIT_LOCK_OFFSET = 8;
 
-  void add_waiter(uint64_t tag, MDSInternalContextBase *c) override;
+  void add_waiter(uint64_t tag, MDSContext *c) override;
 
   bool is_lt(const MDSCacheObject *r) const override {
     return *this < *static_cast<const CDentry*>(r);
index b36ad59e3364b6662e86ccb48d4d236c0df621e5..d3461fba2e0707e84bf580c356a6a74432dd6e06 100644 (file)
@@ -46,7 +46,7 @@
 int CDir::num_frozen_trees = 0;
 int CDir::num_freezing_trees = 0;
 
-class CDirContext : public MDSInternalContextBase
+class CDirContext : public MDSContext
 {
 protected:
   CDir *dir;
@@ -907,7 +907,7 @@ void CDir::steal_dentry(CDentry *dn)
   dn->dir = this;
 }
 
-void CDir::prepare_old_fragment(map<string_snap_t, MDSInternalContextBase::vec >& dentry_waiters, bool replay)
+void CDir::prepare_old_fragment(map<string_snap_t, MDSContext::vec >& dentry_waiters, bool replay)
 {
   // auth_pin old fragment for duration so that any auth_pinning
   // during the dentry migration doesn't trigger side effects
@@ -935,7 +935,7 @@ void CDir::prepare_new_fragment(bool replay)
   inode->add_dirfrag(this);
 }
 
-void CDir::finish_old_fragment(MDSInternalContextBase::vec& waiters, bool replay)
+void CDir::finish_old_fragment(MDSContext::vec& waiters, bool replay)
 {
   // take waiters _before_ unfreeze...
   if (!replay) {
@@ -986,7 +986,7 @@ void CDir::init_fragment_pins()
     get(PIN_SUBTREE);
 }
 
-void CDir::split(int bits, list<CDir*>& subs, MDSInternalContextBase::vec& waiters, bool replay)
+void CDir::split(int bits, list<CDir*>& subs, MDSContext::vec& waiters, bool replay)
 {
   dout(10) << "split by " << bits << " bits on " << *this << dendl;
 
@@ -1010,7 +1010,7 @@ void CDir::split(int bits, list<CDir*>& subs, MDSInternalContextBase::vec& waite
     fragstatdiff.add_delta(fnode.accounted_fragstat, fnode.fragstat);
   dout(10) << " rstatdiff " << rstatdiff << " fragstatdiff " << fragstatdiff << dendl;
 
-  map<string_snap_t, MDSInternalContextBase::vec > dentry_waiters;
+  map<string_snap_t, MDSContext::vec > dentry_waiters;
   prepare_old_fragment(dentry_waiters, replay);
 
   // create subfrag dirs
@@ -1088,7 +1088,7 @@ void CDir::split(int bits, list<CDir*>& subs, MDSInternalContextBase::vec& waite
   finish_old_fragment(waiters, replay);
 }
 
-void CDir::merge(list<CDir*>& subs, MDSInternalContextBase::vec& waiters, bool replay)
+void CDir::merge(list<CDir*>& subs, MDSContext::vec& waiters, bool replay)
 {
   dout(10) << "merge " << subs << dendl;
 
@@ -1108,7 +1108,7 @@ void CDir::merge(list<CDir*>& subs, MDSInternalContextBase::vec& waiters, bool r
   version_t rstat_version = inode->get_projected_inode()->rstat.version;
   version_t dirstat_version = inode->get_projected_inode()->dirstat.version;
 
-  map<string_snap_t, MDSInternalContextBase::vec > dentry_waiters;
+  map<string_snap_t, MDSContext::vec > dentry_waiters;
 
   for (auto dir : subs) {
     dout(10) << " subfrag " << dir->get_frag() << " " << *dir << dendl;
@@ -1253,7 +1253,7 @@ void CDir::assimilate_dirty_rstat_inodes_finish(MutationRef& mut, EMetaBlob *blo
  * WAITING
  */
 
-void CDir::add_dentry_waiter(std::string_view dname, snapid_t snapid, MDSInternalContextBase *c) 
+void CDir::add_dentry_waiter(std::string_view dname, snapid_t snapid, MDSContext *c) 
 {
   if (waiting_on_dentry.empty())
     get(PIN_DNWAITER);
@@ -1264,7 +1264,7 @@ void CDir::add_dentry_waiter(std::string_view dname, snapid_t snapid, MDSInterna
 }
 
 void CDir::take_dentry_waiting(std::string_view dname, snapid_t first, snapid_t last,
-                              MDSInternalContextBase::vec& ls)
+                              MDSContext::vec& ls)
 {
   if (waiting_on_dentry.empty())
     return;
@@ -1288,7 +1288,7 @@ void CDir::take_dentry_waiting(std::string_view dname, snapid_t first, snapid_t
     put(PIN_DNWAITER);
 }
 
-void CDir::take_sub_waiting(MDSInternalContextBase::vec& ls)
+void CDir::take_sub_waiting(MDSContext::vec& ls)
 {
   dout(10) << __func__ << dendl;
   if (!waiting_on_dentry.empty()) {
@@ -1304,7 +1304,7 @@ void CDir::take_sub_waiting(MDSInternalContextBase::vec& ls)
 
 
 
-void CDir::add_waiter(uint64_t tag, MDSInternalContextBase *c) 
+void CDir::add_waiter(uint64_t tag, MDSContext *c) 
 {
   // hierarchical?
   
@@ -1326,7 +1326,7 @@ void CDir::add_waiter(uint64_t tag, MDSInternalContextBase *c)
 
 
 /* NOTE: this checks dentry waiters too */
-void CDir::take_waiting(uint64_t mask, MDSInternalContextBase::vec& ls)
+void CDir::take_waiting(uint64_t mask, MDSContext::vec& ls)
 {
   if ((mask & WAIT_DENTRY) && !waiting_on_dentry.empty()) {
     // take all dentry waiters
@@ -1350,7 +1350,7 @@ void CDir::finish_waiting(uint64_t mask, int result)
 {
   dout(11) << __func__ << " mask " << hex << mask << dec << " result " << result << " on " << *this << dendl;
 
-  MDSInternalContextBase::vec finished;
+  MDSContext::vec finished;
   take_waiting(mask, finished);
   if (result < 0)
     finish_contexts(g_ceph_context, finished, result);
@@ -1431,7 +1431,7 @@ void CDir::mark_new(LogSegment *ls)
   ls->new_dirfrags.push_back(&item_new);
   state_clear(STATE_CREATING);
 
-  MDSInternalContextBase::vec waiters;
+  MDSContext::vec waiters;
   take_waiting(CDir::WAIT_CREATED, waiters);
   cache->mds->queue_waiters(waiters);
 }
@@ -1481,13 +1481,13 @@ void CDir::last_put()
 
 // -----------------------
 // FETCH
-void CDir::fetch(MDSInternalContextBase *c, bool ignore_authpinnability)
+void CDir::fetch(MDSContext *c, bool ignore_authpinnability)
 {
   string want;
   return fetch(c, want, ignore_authpinnability);
 }
 
-void CDir::fetch(MDSInternalContextBase *c, std::string_view want_dn, bool ignore_authpinnability)
+void CDir::fetch(MDSContext *c, std::string_view want_dn, bool ignore_authpinnability)
 {
   dout(10) << "fetch on " << *this << dendl;
   
@@ -1542,7 +1542,7 @@ void CDir::fetch(MDSInternalContextBase *c, std::string_view want_dn, bool ignor
   _omap_fetch(NULL, empty);
 }
 
-void CDir::fetch(MDSInternalContextBase *c, const std::set<dentry_key_t>& keys)
+void CDir::fetch(MDSContext *c, const std::set<dentry_key_t>& keys)
 {
   dout(10) << "fetch " << keys.size() << " keys on " << *this << dendl;
 
@@ -1567,14 +1567,14 @@ void CDir::fetch(MDSInternalContextBase *c, const std::set<dentry_key_t>& keys)
 }
 
 class C_IO_Dir_OMAP_FetchedMore : public CDirIOContext {
-  MDSInternalContextBase *fin;
+  MDSContext *fin;
 public:
   bufferlist hdrbl;
   bool more = false;
   map<string, bufferlist> omap;      ///< carry-over from before
   map<string, bufferlist> omap_more; ///< new batch
   int ret;
-  C_IO_Dir_OMAP_FetchedMore(CDir *d, MDSInternalContextBase *f) :
+  C_IO_Dir_OMAP_FetchedMore(CDir *d, MDSContext *f) :
     CDirIOContext(d), fin(f), ret(0) { }
   void finish(int r) {
     // merge results
@@ -1597,7 +1597,7 @@ public:
 };
 
 class C_IO_Dir_OMAP_Fetched : public CDirIOContext {
-  MDSInternalContextBase *fin;
+  MDSContext *fin;
 public:
   bufferlist hdrbl;
   bool more = false;
@@ -1605,7 +1605,7 @@ public:
   bufferlist btbl;
   int ret1, ret2, ret3;
 
-  C_IO_Dir_OMAP_Fetched(CDir *d, MDSInternalContextBase *f) :
+  C_IO_Dir_OMAP_Fetched(CDir *d, MDSContext *f) :
     CDirIOContext(d), fin(f), ret1(0), ret2(0), ret3(0) { }
   void finish(int r) override {
     // check the correctness of backtrace
@@ -1626,7 +1626,7 @@ public:
   }
 };
 
-void CDir::_omap_fetch(MDSInternalContextBase *c, const std::set<dentry_key_t>& keys)
+void CDir::_omap_fetch(MDSContext *c, const std::set<dentry_key_t>& keys)
 {
   C_IO_Dir_OMAP_Fetched *fin = new C_IO_Dir_OMAP_Fetched(this, c);
   object_t oid = get_ondisk_object();
@@ -1662,7 +1662,7 @@ void CDir::_omap_fetch(MDSInternalContextBase *c, const std::set<dentry_key_t>&
 void CDir::_omap_fetch_more(
   bufferlist& hdrbl,
   map<string, bufferlist>& omap,
-  MDSInternalContextBase *c)
+  MDSContext *c)
 {
   // we have more omap keys to fetch!
   object_t oid = get_ondisk_object();
@@ -2091,7 +2091,7 @@ void CDir::go_bad(bool complete)
  * @param want - min version i want committed
  * @param c - callback for completion
  */
-void CDir::commit(version_t want, MDSInternalContextBase *c, bool ignore_authpinnability, int op_prio)
+void CDir::commit(version_t want, MDSContext *c, bool ignore_authpinnability, int op_prio)
 {
   dout(10) << "commit want " << want << " on " << *this << dendl;
   if (want == 0) want = get_version();
@@ -2454,7 +2454,7 @@ void CDir::_committed(int r, version_t v)
       _commit(it->first, -1);
       break;
     }
-    MDSInternalContextBase::vec t;
+    MDSContext::vec t;
     for (const auto &waiter : it->second)
       t.push_back(waiter);
     cache->mds->queue_waiters(t);
@@ -2698,7 +2698,7 @@ void CDir::set_dir_auth(const mds_authority_t &a)
 
   // newly single auth?
   if (was_ambiguous && dir_auth.second == CDIR_AUTH_UNKNOWN) {
-    MDSInternalContextBase::vec ls;
+    MDSContext::vec ls;
     take_waiting(WAIT_SINGLEAUTH, ls);
     cache->mds->queue_waiters(ls);
   }
@@ -2959,7 +2959,7 @@ void CDir::unfreeze_tree()
 {
   dout(10) << __func__ << " " << *this << dendl;
 
-  MDSInternalContextBase::vec unfreeze_waiters;
+  MDSContext::vec unfreeze_waiters;
   take_waiting(WAIT_UNFREEZE, unfreeze_waiters);
 
   if (freeze_tree_state) {
@@ -3017,7 +3017,7 @@ void CDir::adjust_freeze_after_rename(CDir *dir)
   ceph_assert(!freeze_tree_state->frozen);
   ceph_assert(get_dir_auth_pins() > 0);
 
-  MDSInternalContextBase::vec unfreeze_waiters;
+  MDSContext::vec unfreeze_waiters;
 
   auto unfreeze = [this, &unfreeze_waiters](CDir *dir) {
     if (dir->freeze_tree_state != freeze_tree_state)
@@ -3338,7 +3338,7 @@ void CDir::scrub_finished()
 }
 
 int CDir::_next_dentry_on_set(dentry_key_set &dns, bool missing_okay,
-                              MDSInternalContext *cb, CDentry **dnout)
+                              MDSContext *cb, CDentry **dnout)
 {
   dentry_key_t dnkey;
   CDentry *dn;
@@ -3389,7 +3389,7 @@ int CDir::_next_dentry_on_set(dentry_key_set &dns, bool missing_okay,
   return ENOENT;
 }
 
-int CDir::scrub_dentry_next(MDSInternalContext *cb, CDentry **dnout)
+int CDir::scrub_dentry_next(MDSContext *cb, CDentry **dnout)
 {
   dout(20) << __func__ << dendl;
   ceph_assert(scrub_infop && scrub_infop->directory_scrubbing);
index 2146874ddc071e96361b63822354d8fed7270526..3654c6a04011f54833f685ae6fb21b7bd6a29260 100644 (file)
@@ -306,12 +306,12 @@ public:
    * ENOENT: there are no remaining dentries to scrub
    * <0: There was an unexpected error
    *
-   * @param cb An MDSInternalContext which will be activated only if
+   * @param cb An MDSContext which will be activated only if
    *   we return EAGAIN via rcode, or else ignored
    * @param dnout CDentry * which you should next scrub, or NULL
    * @returns a value as described above
    */
-  int scrub_dentry_next(MDSInternalContext *cb, CDentry **dnout);
+  int scrub_dentry_next(MDSContext *cb, CDentry **dnout);
   /**
    * Get the currently scrubbing dentries. When returned, the passed-in
    * list will be filled with all CDentry * which have been returned
@@ -349,7 +349,7 @@ private:
    * next key to scrub and look it up (or fail!).
    */
   int _next_dentry_on_set(dentry_key_set &dns, bool missing_okay,
-                          MDSInternalContext *cb, CDentry **dnout);
+                          MDSContext *cb, CDentry **dnout);
 
 
 protected:
@@ -500,8 +500,8 @@ public:
 
 
 public:
-  void split(int bits, std::list<CDir*>& subs, MDSInternalContextBase::vec& waiters, bool replay);
-  void merge(std::list<CDir*>& subs, MDSInternalContextBase::vec& waiters, bool replay);
+  void split(int bits, std::list<CDir*>& subs, MDSContext::vec& waiters, bool replay);
+  void merge(std::list<CDir*>& subs, MDSContext::vec& waiters, bool replay);
 
   bool should_split() const {
     return (int)get_frag_size() > g_conf()->mds_bal_split_size;
@@ -513,9 +513,9 @@ public:
 
 private:
   void prepare_new_fragment(bool replay);
-  void prepare_old_fragment(map<string_snap_t, MDSInternalContextBase::vec >& dentry_waiters, bool replay);
+  void prepare_old_fragment(map<string_snap_t, MDSContext::vec >& dentry_waiters, bool replay);
   void steal_dentry(CDentry *dn);  // from another dir.  used by merge/split.
-  void finish_old_fragment(MDSInternalContextBase::vec& waiters, bool replay);
+  void finish_old_fragment(MDSContext::vec& waiters, bool replay);
   void init_fragment_pins();
 
 
@@ -605,16 +605,16 @@ private:
   object_t get_ondisk_object() { 
     return file_object_t(ino(), frag);
   }
-  void fetch(MDSInternalContextBase *c, bool ignore_authpinnability=false);
-  void fetch(MDSInternalContextBase *c, std::string_view want_dn, bool ignore_authpinnability=false);
-  void fetch(MDSInternalContextBase *c, const std::set<dentry_key_t>& keys);
+  void fetch(MDSContext *c, bool ignore_authpinnability=false);
+  void fetch(MDSContext *c, std::string_view want_dn, bool ignore_authpinnability=false);
+  void fetch(MDSContext *c, const std::set<dentry_key_t>& keys);
 protected:
   mempool::mds_co::compact_set<mempool::mds_co::string> wanted_items;
 
-  void _omap_fetch(MDSInternalContextBase *fin, const std::set<dentry_key_t>& keys);
+  void _omap_fetch(MDSContext *fin, const std::set<dentry_key_t>& keys);
   void _omap_fetch_more(
     bufferlist& hdrbl, std::map<std::string, bufferlist>& omap,
-    MDSInternalContextBase *fin);
+    MDSContext *fin);
   CDentry *_load_dentry(
       std::string_view key,
       std::string_view dname,
@@ -643,7 +643,7 @@ protected:
                     bool complete, int r);
 
   // -- commit --
-  mempool::mds_co::compact_map<version_t, MDSInternalContextBase::vec_alloc<mempool::mds_co::pool_allocator> > waiting_for_commit;
+  mempool::mds_co::compact_map<version_t, MDSContext::vec_alloc<mempool::mds_co::pool_allocator> > waiting_for_commit;
   void _commit(version_t want, int op_prio);
   void _omap_commit(int op_prio);
   void _encode_dentry(CDentry *dn, bufferlist& bl, const std::set<snapid_t> *snaps);
@@ -653,7 +653,7 @@ public:
   void wait_for_commit(Context *c, version_t v=0);
 #endif
   void commit_to(version_t want);
-  void commit(version_t want, MDSInternalContextBase *c,
+  void commit(version_t want, MDSContext *c,
              bool ignore_authpinnability=false, int op_prio=-1);
 
   // -- dirtyness --
@@ -670,18 +670,18 @@ public:
 
   // -- waiters --
 protected:
-  mempool::mds_co::compact_map< string_snap_t, MDSInternalContextBase::vec_alloc<mempool::mds_co::pool_allocator> > waiting_on_dentry; // FIXME string_snap_t not in mempool
+  mempool::mds_co::compact_map< string_snap_t, MDSContext::vec_alloc<mempool::mds_co::pool_allocator> > waiting_on_dentry; // FIXME string_snap_t not in mempool
 
 public:
   bool is_waiting_for_dentry(std::string_view dname, snapid_t snap) {
     return waiting_on_dentry.count(string_snap_t(dname, snap));
   }
-  void add_dentry_waiter(std::string_view dentry, snapid_t snap, MDSInternalContextBase *c);
-  void take_dentry_waiting(std::string_view dentry, snapid_t first, snapid_t last, MDSInternalContextBase::vec& ls);
-  void take_sub_waiting(MDSInternalContextBase::vec& ls);  // dentry or ino
+  void add_dentry_waiter(std::string_view dentry, snapid_t snap, MDSContext *c);
+  void take_dentry_waiting(std::string_view dentry, snapid_t first, snapid_t last, MDSContext::vec& ls);
+  void take_sub_waiting(MDSContext::vec& ls);  // dentry or ino
 
-  void add_waiter(uint64_t mask, MDSInternalContextBase *c) override;
-  void take_waiting(uint64_t mask, MDSInternalContextBase::vec& ls) override;  // may include dentry waiters
+  void add_waiter(uint64_t mask, MDSContext *c) override;
+  void take_waiting(uint64_t mask, MDSContext::vec& ls) override;  // may include dentry waiters
   void finish_waiting(uint64_t mask, int result = 0);    // ditto
   
 
index 9a6193abae6795b272ccca006ee4bc74a8f41f75..178533abf939cefc8edad1778c7400dbf361f1af 100644 (file)
@@ -1079,7 +1079,7 @@ object_t InodeStoreBase::get_object_name(inodeno_t ino, frag_t fg, std::string_v
   return object_t(n);
 }
 
-void CInode::store(MDSInternalContextBase *fin)
+void CInode::store(MDSContext *fin)
 {
   dout(10) << __func__ << " " << get_version() << dendl;
   ceph_assert(is_base());
@@ -1128,7 +1128,7 @@ void CInode::_stored(int r, version_t v, Context *fin)
   fin->complete(0);
 }
 
-void CInode::flush(MDSInternalContextBase *fin)
+void CInode::flush(MDSContext *fin)
 {
   dout(10) << __func__ << " " << *this << dendl;
   ceph_assert(is_auth() && can_auth_pin());
@@ -1167,7 +1167,7 @@ struct C_IO_Inode_Fetched : public CInodeIOContext {
   }
 };
 
-void CInode::fetch(MDSInternalContextBase *fin)
+void CInode::fetch(MDSContext *fin)
 {
   dout(10) << __func__  << dendl;
 
@@ -1259,7 +1259,7 @@ struct C_IO_Inode_StoredBacktrace : public CInodeIOContext {
   }
 };
 
-void CInode::store_backtrace(MDSInternalContextBase *fin, int op_prio)
+void CInode::store_backtrace(MDSContext *fin, int op_prio)
 {
   dout(10) << __func__ << " on " << *this << dendl;
   ceph_assert(is_dirty_parent());
@@ -2411,7 +2411,7 @@ bool CInode::is_freezing() const
   return false;
 }
 
-void CInode::add_dir_waiter(frag_t fg, MDSInternalContextBase *c)
+void CInode::add_dir_waiter(frag_t fg, MDSContext *c)
 {
   if (waiting_on_dir.empty())
     get(PIN_DIRWAITER);
@@ -2419,7 +2419,7 @@ void CInode::add_dir_waiter(frag_t fg, MDSInternalContextBase *c)
   dout(10) << __func__ << " frag " << fg << " " << c << " on " << *this << dendl;
 }
 
-void CInode::take_dir_waiting(frag_t fg, MDSInternalContextBase::vec& ls)
+void CInode::take_dir_waiting(frag_t fg, MDSContext::vec& ls)
 {
   if (waiting_on_dir.empty())
     return;
@@ -2436,7 +2436,7 @@ void CInode::take_dir_waiting(frag_t fg, MDSInternalContextBase::vec& ls)
   }
 }
 
-void CInode::add_waiter(uint64_t tag, MDSInternalContextBase *c) 
+void CInode::add_waiter(uint64_t tag, MDSContext *c) 
 {
   dout(10) << __func__ << " tag " << std::hex << tag << std::dec << " " << c
           << " !ambig " << !state_test(STATE_AMBIGUOUSAUTH)
@@ -2456,7 +2456,7 @@ void CInode::add_waiter(uint64_t tag, MDSInternalContextBase *c)
   MDSCacheObject::add_waiter(tag, c);
 }
 
-void CInode::take_waiting(uint64_t mask, MDSInternalContextBase::vec& ls)
+void CInode::take_waiting(uint64_t mask, MDSContext::vec& ls)
 {
   if ((mask & WAIT_DIR) && !waiting_on_dir.empty()) {
     // take all dentry waiters
@@ -2495,7 +2495,7 @@ bool CInode::freeze_inode(int auth_pin_allowance)
   return true;
 }
 
-void CInode::unfreeze_inode(MDSInternalContextBase::vec& finished) 
+void CInode::unfreeze_inode(MDSContext::vec& finished) 
 {
   dout(10) << __func__ << dendl;
   if (state_test(STATE_FREEZING)) {
@@ -2511,7 +2511,7 @@ void CInode::unfreeze_inode(MDSInternalContextBase::vec& finished)
 
 void CInode::unfreeze_inode()
 {
-    MDSInternalContextBase::vec finished;
+    MDSContext::vec finished;
     unfreeze_inode(finished);
     mdcache->mds->queue_waiters(finished);
 }
@@ -2527,13 +2527,13 @@ void CInode::unfreeze_auth_pin()
   ceph_assert(state_test(CInode::STATE_FROZENAUTHPIN));
   state_clear(CInode::STATE_FROZENAUTHPIN);
   if (!state_test(STATE_FREEZING|STATE_FROZEN)) {
-    MDSInternalContextBase::vec finished;
+    MDSContext::vec finished;
     take_waiting(WAIT_UNFREEZE, finished);
     mdcache->mds->queue_waiters(finished);
   }
 }
 
-void CInode::clear_ambiguous_auth(MDSInternalContextBase::vec& finished)
+void CInode::clear_ambiguous_auth(MDSContext::vec& finished)
 {
   ceph_assert(state_test(CInode::STATE_AMBIGUOUSAUTH));
   state_clear(CInode::STATE_AMBIGUOUSAUTH);
@@ -2542,7 +2542,7 @@ void CInode::clear_ambiguous_auth(MDSInternalContextBase::vec& finished)
 
 void CInode::clear_ambiguous_auth()
 {
-  MDSInternalContextBase::vec finished;
+  MDSContext::vec finished;
   clear_ambiguous_auth(finished);
   mdcache->mds->queue_waiters(finished);
 }
@@ -3053,7 +3053,7 @@ void CInode::remove_client_cap(client_t client)
   bool fcntl_removed = fcntl_locks ? fcntl_locks->remove_all_from(client) : false;
   bool flock_removed = flock_locks ? flock_locks->remove_all_from(client) : false; 
   if (fcntl_removed || flock_removed) {
-    MDSInternalContextBase::vec waiters;
+    MDSContext::vec waiters;
     take_waiting(CInode::WAIT_FLOCK, waiters);
     mdcache->mds->queue_waiters(waiters);
   }
@@ -3876,7 +3876,7 @@ void CInode::_decode_locks_state(bufferlist::const_iterator& p, bool is_new)
     policylock.mark_need_recover();
   }
 }
-void CInode::_decode_locks_rejoin(bufferlist::const_iterator& p, MDSInternalContextBase::vec& waiters,
+void CInode::_decode_locks_rejoin(bufferlist::const_iterator& p, MDSContext::vec& waiters,
                                  list<SimpleLock*>& eval_locks, bool survivor)
 {
   authlock.decode_state_rejoin(p, waiters, survivor);
@@ -4066,11 +4066,11 @@ void InodeStoreBare::generate_test_instances(list<InodeStoreBare*> &ls)
 }
 
 void CInode::validate_disk_state(CInode::validated_data *results,
-                                 MDSInternalContext *fin)
+                                 MDSContext *fin)
 {
   class ValidationContinuation : public MDSContinuation {
   public:
-    MDSInternalContext *fin;
+    MDSContext *fin;
     CInode *in;
     CInode::validated_data *results;
     bufferlist bl;
@@ -4086,7 +4086,7 @@ void CInode::validate_disk_state(CInode::validated_data *results,
 
     ValidationContinuation(CInode *i,
                            CInode::validated_data *data_r,
-                           MDSInternalContext *fin_) :
+                           MDSContext *fin_) :
                              MDSContinuation(i->mdcache->mds->server),
                              fin(fin_),
                              in(i),
@@ -4664,7 +4664,7 @@ void CInode::scrub_maybe_delete_info()
 
 void CInode::scrub_initialize(CDentry *scrub_parent,
                              ScrubHeaderRef& header,
-                             MDSInternalContextBase *f)
+                             MDSContext *f)
 {
   dout(20) << __func__ << " with scrub_version " << get_version() << dendl;
   if (scrub_is_in_progress()) {
@@ -4769,7 +4769,7 @@ void CInode::scrub_dirfrag_finished(frag_t dirfrag)
   si.last_scrub_version = si.scrub_start_version;
 }
 
-void CInode::scrub_aborted(MDSInternalContextBase **c) {
+void CInode::scrub_aborted(MDSContext **c) {
   dout(20) << __func__ << dendl;
   ceph_assert(scrub_is_in_progress());
 
@@ -4787,7 +4787,7 @@ void CInode::scrub_aborted(MDSInternalContextBase **c) {
   scrub_infop = nullptr;
 }
 
-void CInode::scrub_finished(MDSInternalContextBase **c) {
+void CInode::scrub_finished(MDSContext **c) {
   dout(20) << __func__ << dendl;
   ceph_assert(scrub_is_in_progress());
   for (std::map<frag_t, scrub_stamp_info_t>::iterator i =
index 725d80483e3021f342c4f2dfbb4267df001a70d9..54cbe46535fad221ef3685e14cdb80799f44553f 100644 (file)
@@ -285,7 +285,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
   class scrub_info_t : public scrub_stamp_info_t {
   public:
     CDentry *scrub_parent = nullptr;
-    MDSInternalContextBase *on_finish = nullptr;
+    MDSContext *on_finish = nullptr;
 
     bool last_scrub_dirty = false; /// are our stamps dirty with respect to disk state?
     bool scrub_in_progress = false; /// are we currently scrubbing?
@@ -326,7 +326,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
    */
   void scrub_initialize(CDentry *scrub_parent,
                        ScrubHeaderRef& header,
-                       MDSInternalContextBase *f);
+                       MDSContext *f);
   /**
    * Get the next dirfrag to scrub. Gives you a frag_t in output param which
    * you must convert to a CDir (and possibly load off disk).
@@ -357,9 +357,9 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
    * @param c An out param which is filled in with a Context* that must
    * be complete()ed.
    */
-  void scrub_finished(MDSInternalContextBase **c);
+  void scrub_finished(MDSContext **c);
 
-  void scrub_aborted(MDSInternalContextBase **c);
+  void scrub_aborted(MDSContext **c);
 
   /**
    * Report to the CInode that alldirfrags it owns have been scrubbed.
@@ -367,7 +367,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
   void scrub_children_finished() {
     scrub_infop->children_scrubbed = true;
   }
-  void scrub_set_finisher(MDSInternalContextBase *c) {
+  void scrub_set_finisher(MDSContext *c) {
     ceph_assert(!scrub_infop->on_finish);
     scrub_infop->on_finish = c;
   }
@@ -753,7 +753,7 @@ public:
   void set_ambiguous_auth() {
     state_set(STATE_AMBIGUOUSAUTH);
   }
-  void clear_ambiguous_auth(MDSInternalContextBase::vec& finished);
+  void clear_ambiguous_auth(MDSContext::vec& finished);
   void clear_ambiguous_auth();
 
   inodeno_t ino() const { return inode.ino; }
@@ -798,7 +798,7 @@ public:
   void mark_dirty(version_t projected_dirv, LogSegment *ls);
   void mark_clean();
 
-  void store(MDSInternalContextBase *fin);
+  void store(MDSContext *fin);
   void _stored(int r, version_t cv, Context *fin);
   /**
    * Flush a CInode to disk. This includes the backtrace, the parent
@@ -807,13 +807,13 @@ public:
    * @pre can_auth_pin()
    * @param fin The Context to call when the flush is completed.
    */
-  void flush(MDSInternalContextBase *fin);
-  void fetch(MDSInternalContextBase *fin);
+  void flush(MDSContext *fin);
+  void fetch(MDSContext *fin);
   void _fetched(bufferlist& bl, bufferlist& bl2, Context *fin);  
 
 
   void build_backtrace(int64_t pool, inode_backtrace_t& bt);
-  void store_backtrace(MDSInternalContextBase *fin, int op_prio=-1);
+  void store_backtrace(MDSContext *fin, int op_prio=-1);
   void _stored_backtrace(int r, version_t v, Context *fin);
   void fetch_backtrace(Context *fin, bufferlist *backtrace);
 protected:
@@ -862,15 +862,15 @@ public:
 
   // -- waiting --
 protected:
-  mempool::mds_co::compact_map<frag_t, MDSInternalContextBase::vec > waiting_on_dir;
+  mempool::mds_co::compact_map<frag_t, MDSContext::vec > waiting_on_dir;
 public:
-  void add_dir_waiter(frag_t fg, MDSInternalContextBase *c);
-  void take_dir_waiting(frag_t fg, MDSInternalContextBase::vec& ls);
+  void add_dir_waiter(frag_t fg, MDSContext *c);
+  void take_dir_waiting(frag_t fg, MDSContext::vec& ls);
   bool is_waiting_for_dir(frag_t fg) {
     return waiting_on_dir.count(fg);
   }
-  void add_waiter(uint64_t tag, MDSInternalContextBase *c) override;
-  void take_waiting(uint64_t tag, MDSInternalContextBase::vec& ls) override;
+  void add_waiter(uint64_t tag, MDSContext *c) override;
+  void take_waiting(uint64_t tag, MDSContext::vec& ls) override;
 
   // -- encode/decode helpers --
   void _encode_base(bufferlist& bl, uint64_t features);
@@ -880,7 +880,7 @@ public:
   void _encode_locks_state_for_replica(bufferlist& bl, bool need_recover);
   void _encode_locks_state_for_rejoin(bufferlist& bl, int rep);
   void _decode_locks_state(bufferlist::const_iterator& p, bool is_new);
-  void _decode_locks_rejoin(bufferlist::const_iterator& p, MDSInternalContextBase::vec& waiters,
+  void _decode_locks_rejoin(bufferlist::const_iterator& p, MDSContext::vec& waiters,
                            std::list<SimpleLock*>& eval_locks, bool survivor);
 
   // -- import/export --
@@ -1079,7 +1079,7 @@ public:
   /* Freeze the inode. auth_pin_allowance lets the caller account for any
    * auth_pins it is itself holding/responsible for. */
   bool freeze_inode(int auth_pin_allowance=0);
-  void unfreeze_inode(MDSInternalContextBase::vec& finished);
+  void unfreeze_inode(MDSContext::vec& finished);
   void unfreeze_inode();
 
   void freeze_auth_pin();
@@ -1206,7 +1206,7 @@ public:
    * @param fin Context to call back on completion (or NULL)
    */
   void validate_disk_state(validated_data *results,
-                           MDSInternalContext *fin);
+                           MDSContext *fin);
   static void dump_validation_results(const validated_data& results,
                                       Formatter *f);
 private:
index c46effcfa5bebe44282df0cdee11eee17eba50c7..c6c78d217292d5414d3844b74c767b83e4917cb7 100644 (file)
@@ -57,7 +57,7 @@ static ostream& _prefix(std::ostream *_dout, MDSRank *mds) {
 }
 
 
-class LockerContext : public MDSInternalContextBase {
+class LockerContext : public MDSContext {
 protected:
   Locker *locker;
   MDSRank *get_mds() override
@@ -805,7 +805,7 @@ void Locker::drop_locks_for_fragment_unfreeze(MutationImpl *mut)
 
 // generics
 
-void Locker::eval_gather(SimpleLock *lock, bool first, bool *pneed_issue, MDSInternalContextBase::vec *pfinishers)
+void Locker::eval_gather(SimpleLock *lock, bool first, bool *pneed_issue, MDSContext::vec *pfinishers)
 {
   dout(10) << "eval_gather " << *lock << " on " << *lock->get_parent() << dendl;
   ceph_assert(!lock->is_stable());
@@ -1028,7 +1028,7 @@ void Locker::eval_gather(SimpleLock *lock, bool first, bool *pneed_issue, MDSInt
 bool Locker::eval(CInode *in, int mask, bool caps_imported)
 {
   bool need_issue = caps_imported;
-  MDSInternalContextBase::vec finishers;
+  MDSContext::vec finishers;
   
   dout(10) << "eval " << mask << " " << *in << dendl;
 
@@ -1191,7 +1191,7 @@ void Locker::try_eval(SimpleLock *lock, bool *pneed_issue)
 void Locker::eval_cap_gather(CInode *in, set<CInode*> *issue_set)
 {
   bool need_issue = false;
-  MDSInternalContextBase::vec finishers;
+  MDSContext::vec finishers;
 
   // kick locks now
   if (!in->filelock.is_stable())
@@ -1216,7 +1216,7 @@ void Locker::eval_cap_gather(CInode *in, set<CInode*> *issue_set)
 void Locker::eval_scatter_gathers(CInode *in)
 {
   bool need_issue = false;
-  MDSInternalContextBase::vec finishers;
+  MDSContext::vec finishers;
 
   dout(10) << "eval_scatter_gathers " << *in << dendl;
 
@@ -1295,7 +1295,7 @@ bool Locker::_rdlock_kick(SimpleLock *lock, bool as_anon)
   return false;
 }
 
-bool Locker::rdlock_try(SimpleLock *lock, client_t client, MDSInternalContextBase *con)
+bool Locker::rdlock_try(SimpleLock *lock, client_t client, MDSContext *con)
 {
   dout(7) << "rdlock_try on " << *lock << " on " << *lock->get_parent() << dendl;  
 
@@ -4578,7 +4578,7 @@ void Locker::mark_updated_scatterlock(ScatterLock *lock)
  * we need to lock|scatter in order to push fnode changes into the
  * inode.dirstat.
  */
-void Locker::scatter_nudge(ScatterLock *lock, MDSInternalContextBase *c, bool forcelockchange)
+void Locker::scatter_nudge(ScatterLock *lock, MDSContext *c, bool forcelockchange)
 {
   CInode *p = static_cast<CInode *>(lock->get_parent());
 
index 5e935b5c8276a901acd7e2e891fd9698ea567a88..47b5b779edd78f20de280fd0bf8b86ba4af6e104 100644 (file)
@@ -85,9 +85,9 @@ public:
   void drop_rdlocks_for_early_reply(MutationImpl *mut);
   void drop_locks_for_fragment_unfreeze(MutationImpl *mut);
 
-  void eval_gather(SimpleLock *lock, bool first=false, bool *need_issue=0, MDSInternalContextBase::vec *pfinishers=0);
+  void eval_gather(SimpleLock *lock, bool first=false, bool *need_issue=0, MDSContext::vec *pfinishers=0);
   void eval(SimpleLock *lock, bool *need_issue);
-  void eval_any(SimpleLock *lock, bool *need_issue, MDSInternalContextBase::vec *pfinishers=0, bool first=false) {
+  void eval_any(SimpleLock *lock, bool *need_issue, MDSContext::vec *pfinishers=0, bool first=false) {
     if (!lock->is_stable())
       eval_gather(lock, first, need_issue, pfinishers);
     else if (lock->get_parent()->is_auth())
@@ -103,7 +103,7 @@ public:
   void try_eval(SimpleLock *lock, bool *pneed_issue);
 
   bool _rdlock_kick(SimpleLock *lock, bool as_anon);
-  bool rdlock_try(SimpleLock *lock, client_t client, MDSInternalContextBase *c);
+  bool rdlock_try(SimpleLock *lock, client_t client, MDSContext *c);
   bool rdlock_start(SimpleLock *lock, MDRequestRef& mut, bool as_anon=false);
   void rdlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut, bool *pneed_issue);
   bool can_rdlock_set(MutationImpl::LockOpVec& lov);
@@ -127,7 +127,7 @@ public:
   // simple
 public:
   void try_simple_eval(SimpleLock *lock);
-  bool simple_rdlock_try(SimpleLock *lock, MDSInternalContextBase *con);
+  bool simple_rdlock_try(SimpleLock *lock, MDSContext *con);
 protected:
   void simple_eval(SimpleLock *lock, bool *need_issue);
   void handle_simple_lock(SimpleLock *lock, const MLock::const_ref &m);
@@ -145,7 +145,7 @@ public:
   void scatter_eval(ScatterLock *lock, bool *need_issue);        // public for MDCache::adjust_subtree_auth()
 
   void scatter_tick();
-  void scatter_nudge(ScatterLock *lock, MDSInternalContextBase *c, bool forcelockchange=false);
+  void scatter_nudge(ScatterLock *lock, MDSContext *c, bool forcelockchange=false);
 
 protected:
   void handle_scatter_lock(ScatterLock *lock, const MLock::const_ref &m);
index 732588417572de2c59df95601c09af43a70d93ac..f412a747541c25b4081195829649c9ce4456736a 100644 (file)
@@ -74,9 +74,9 @@ class LogSegment {
   // try to expire
   void try_to_expire(MDSRank *mds, MDSGatherBuilder &gather_bld, int op_prio);
 
-  MDSInternalContextBase::vec expiry_waiters;
+  MDSContext::vec expiry_waiters;
 
-  void wait_for_expiry(MDSInternalContextBase *c)
+  void wait_for_expiry(MDSContext *c)
   {
     ceph_assert(c != NULL);
     expiry_waiters.push_back(c);
index 841f68d12a6638733b3959d471aff31f7f1f8efc..9f62efdefc2ffef63b448d089c53d016feb82051 100644 (file)
@@ -88,7 +88,7 @@ set<int> SimpleLock::empty_gather_set;
  * All non-I/O contexts that require a reference
  * to an MDCache instance descend from this.
  */
-class MDCacheContext : public virtual MDSInternalContextBase {
+class MDCacheContext : public virtual MDSContext {
 protected:
   MDCache *mdcache;
   MDSRank *get_mds() override
@@ -488,15 +488,15 @@ struct C_MDC_CreateSystemFile : public MDCacheLogContext {
   MutationRef mut;
   CDentry *dn;
   version_t dpv;
-  MDSInternalContextBase *fin;
-  C_MDC_CreateSystemFile(MDCache *c, MutationRef& mu, CDentry *d, version_t v, MDSInternalContextBase *f) :
+  MDSContext *fin;
+  C_MDC_CreateSystemFile(MDCache *c, MutationRef& mu, CDentry *d, version_t v, MDSContext *f) :
     MDCacheLogContext(c), mut(mu), dn(d), dpv(v), fin(f) {}
   void finish(int r) override {
     mdcache->_create_system_file_finish(mut, dn, dpv, fin);
   }
 };
 
-void MDCache::_create_system_file(CDir *dir, std::string_view name, CInode *in, MDSInternalContextBase *fin)
+void MDCache::_create_system_file(CDir *dir, std::string_view name, CInode *in, MDSContext *fin)
 {
   dout(10) << "_create_system_file " << name << " in " << *dir << dendl;
   CDentry *dn = dir->add_null_dentry(name);
@@ -545,7 +545,7 @@ void MDCache::_create_system_file(CDir *dir, std::string_view name, CInode *in,
   mds->mdlog->flush();
 }
 
-void MDCache::_create_system_file_finish(MutationRef& mut, CDentry *dn, version_t dpv, MDSInternalContextBase *fin)
+void MDCache::_create_system_file_finish(MutationRef& mut, CDentry *dn, version_t dpv, MDSContext *fin)
 {
   dout(10) << "_create_system_file_finish " << *dn << dendl;
   
@@ -592,7 +592,7 @@ struct C_MDS_RetryOpenRoot : public MDSInternalContext {
   }
 };
 
-void MDCache::open_root_inode(MDSInternalContextBase *c)
+void MDCache::open_root_inode(MDSContext *c)
 {
   if (mds->get_nodeid() == mds->mdsmap->get_root()) {
     CInode *in;
@@ -603,13 +603,13 @@ void MDCache::open_root_inode(MDSInternalContextBase *c)
   }
 }
 
-void MDCache::open_mydir_inode(MDSInternalContextBase *c)
+void MDCache::open_mydir_inode(MDSContext *c)
 {
   CInode *in = create_system_inode(MDS_INO_MDSDIR(mds->get_nodeid()), S_IFDIR|0755);  // initially inaccurate!
   in->fetch(c);
 }
 
-void MDCache::open_mydir_frag(MDSInternalContextBase *c)
+void MDCache::open_mydir_frag(MDSContext *c)
 {
   open_mydir_inode(
       new MDSInternalContextWrapper(mds,
@@ -750,7 +750,7 @@ void MDCache::populate_mydir()
   scan_stray_dir();
 }
 
-void MDCache::open_foreign_mdsdir(inodeno_t ino, MDSInternalContextBase *fin)
+void MDCache::open_foreign_mdsdir(inodeno_t ino, MDSContext *fin)
 {
   discover_base_ino(ino, fin, mds_rank_t(ino & (MAX_MDS-1)));
 }
@@ -2678,7 +2678,7 @@ void MDCache::dump_resolve_status(Formatter *f) const
   f->close_section();
 }
 
-void MDCache::resolve_start(MDSInternalContext *resolve_done_)
+void MDCache::resolve_start(MDSContext *resolve_done_)
 {
   dout(10) << "resolve_start" << dendl;
   ceph_assert(!resolve_done);
@@ -3095,7 +3095,7 @@ void MDCache::handle_mds_recovery(mds_rank_t who)
   static const uint64_t i_mask = CInode::WAIT_ANY_MASK & ~CInode::WAIT_DIR;
   static const uint64_t d_mask = CDir::WAIT_ANY_MASK & ~CDir::WAIT_DENTRY;
 
-  MDSInternalContextBase::vec waiters;
+  MDSContext::vec waiters;
 
   // wake up any waiters in their subtrees
   for (map<CDir*,set<CDir*> >::iterator p = subtrees.begin();
@@ -3942,7 +3942,7 @@ void MDCache::dump_rejoin_status(Formatter *f) const
   f->close_section();
 }
 
-void MDCache::rejoin_start(MDSInternalContext *rejoin_done_)
+void MDCache::rejoin_start(MDSContext *rejoin_done_)
 {
   dout(10) << "rejoin_start" << dendl;
   ceph_assert(!rejoin_done);
@@ -5723,7 +5723,7 @@ void MDCache::export_remaining_imported_caps()
     mds->heartbeat_reset();
   }
 
-  for (map<inodeno_t, MDSInternalContextBase::vec >::iterator p = cap_reconnect_waiters.begin();
+  for (map<inodeno_t, MDSContext::vec >::iterator p = cap_reconnect_waiters.begin();
        p != cap_reconnect_waiters.end();
        ++p)
     mds->queue_waiters(p->second);
@@ -5764,7 +5764,7 @@ Capability* MDCache::try_reconnect_cap(CInode *in, Session *session)
       dout(15) << " chose lock states on " << *in << dendl;
     }
 
-    map<inodeno_t, MDSInternalContextBase::vec >::iterator it =
+    map<inodeno_t, MDSContext::vec >::iterator it =
       cap_reconnect_waiters.find(in->ino());
     if (it != cap_reconnect_waiters.end()) {
       mds->queue_waiters(it->second);
@@ -6472,7 +6472,7 @@ void MDCache::truncate_inode_logged(CInode *in, MutationRef& mut)
   in->put(CInode::PIN_TRUNCATING);
   in->auth_unpin(this);
 
-  MDSInternalContextBase::vec waiters;
+  MDSContext::vec waiters;
   in->take_waiting(CInode::WAIT_TRUNC, waiters);
   mds->queue_waiters(waiters);
 }
@@ -7873,7 +7873,7 @@ again:
       }
 
       if (!dir->is_complete()) {
-       MDSInternalContextBase *fin = nullptr;
+       MDSContext *fin = nullptr;
        if (shutdown_exporting_strays.empty()) {
          fin = new MDSInternalContextWrapper(mds,
                  new FunctionContext([this](int r) {
@@ -8388,7 +8388,7 @@ CInode *MDCache::cache_traverse(const filepath& fp)
  * @param approxfg approximate fragment.
  * @param fin completion callback
  */
-void MDCache::open_remote_dirfrag(CInode *diri, frag_t approxfg, MDSInternalContextBase *fin) 
+void MDCache::open_remote_dirfrag(CInode *diri, frag_t approxfg, MDSContext *fin) 
 {
   dout(10) << "open_remote_dir on " << *diri << dendl;
   ceph_assert(diri->is_dir());
@@ -8437,9 +8437,9 @@ CInode *MDCache::get_dentry_inode(CDentry *dn, MDRequestRef& mdr, bool projected
 struct C_MDC_OpenRemoteDentry : public MDCacheContext {
   CDentry *dn;
   inodeno_t ino;
-  MDSInternalContextBase *onfinish;
+  MDSContext *onfinish;
   bool want_xlocked;
-  C_MDC_OpenRemoteDentry(MDCache *m, CDentry *d, inodeno_t i, MDSInternalContextBase *f, bool wx) :
+  C_MDC_OpenRemoteDentry(MDCache *m, CDentry *d, inodeno_t i, MDSContext *f, bool wx) :
     MDCacheContext(m), dn(d), ino(i), onfinish(f), want_xlocked(wx) {
     dn->get(MDSCacheObject::PIN_PTRWAITER);
   }
@@ -8449,7 +8449,7 @@ struct C_MDC_OpenRemoteDentry : public MDCacheContext {
   }
 };
 
-void MDCache::open_remote_dentry(CDentry *dn, bool projected, MDSInternalContextBase *fin, bool want_xlocked)
+void MDCache::open_remote_dentry(CDentry *dn, bool projected, MDSContext *fin, bool want_xlocked)
 {
   dout(10) << "open_remote_dentry " << *dn << dendl;
   CDentry::linkage_t *dnl = projected ? dn->get_projected_linkage() : dn->get_linkage();
@@ -8459,7 +8459,7 @@ void MDCache::open_remote_dentry(CDentry *dn, bool projected, MDSInternalContext
       new C_MDC_OpenRemoteDentry(this, dn, ino, fin, want_xlocked), true, want_xlocked); // backtrace
 }
 
-void MDCache::_open_remote_dentry_finish(CDentry *dn, inodeno_t ino, MDSInternalContextBase *fin,
+void MDCache::_open_remote_dentry_finish(CDentry *dn, inodeno_t ino, MDSContext *fin,
                                         bool want_xlocked, int r)
 {
   if (r < 0) {
@@ -8786,7 +8786,7 @@ void MDCache::open_ino_finish(inodeno_t ino, open_ino_info_t& info, int ret)
 {
   dout(10) << "open_ino_finish ino " << ino << " ret " << ret << dendl;
 
-  MDSInternalContextBase::vec waiters;
+  MDSContext::vec waiters;
   waiters.swap(info.waiters);
   opening_inodes.erase(ino);
   finish_contexts(g_ceph_context, waiters, ret);
@@ -8982,7 +8982,7 @@ void MDCache::kick_open_ino_peers(mds_rank_t who)
   }
 }
 
-void MDCache::open_ino(inodeno_t ino, int64_t pool, MDSInternalContextBase* fin,
+void MDCache::open_ino(inodeno_t ino, int64_t pool, MDSContext* fin,
                       bool want_replica, bool want_xlocked)
 {
   dout(10) << "open_ino " << ino << " pool " << pool << " want_replica "
@@ -9038,7 +9038,7 @@ void MDCache::open_ino(inodeno_t ino, int64_t pool, MDSInternalContextBase* fin,
   - traverse path
 
  */
-void MDCache::find_ino_peers(inodeno_t ino, MDSInternalContextBase *c, mds_rank_t hint)
+void MDCache::find_ino_peers(inodeno_t ino, MDSContext *c, mds_rank_t hint)
 {
   dout(5) << "find_ino_peers " << ino << " hint " << hint << dendl;
   CInode *in = get_inode(ino);
@@ -9780,7 +9780,7 @@ void MDCache::_send_discover(discover_info_t& d)
 }
 
 void MDCache::discover_base_ino(inodeno_t want_ino,
-                               MDSInternalContextBase *onfinish,
+                               MDSContext *onfinish,
                                mds_rank_t from) 
 {
   dout(7) << "discover_base_ino " << want_ino << " from mds." << from << dendl;
@@ -9795,7 +9795,7 @@ void MDCache::discover_base_ino(inodeno_t want_ino,
 
 void MDCache::discover_dir_frag(CInode *base,
                                frag_t approx_fg,
-                               MDSInternalContextBase *onfinish,
+                               MDSContext *onfinish,
                                mds_rank_t from)
 {
   if (from < 0)
@@ -9833,7 +9833,7 @@ struct C_MDC_RetryDiscoverPath : public MDCacheContext {
 void MDCache::discover_path(CInode *base,
                            snapid_t snap,
                            filepath want_path,
-                           MDSInternalContextBase *onfinish,
+                           MDSContext *onfinish,
                            bool want_xlocked,
                            mds_rank_t from)
 {
@@ -9851,7 +9851,7 @@ void MDCache::discover_path(CInode *base,
     base->add_waiter(CInode::WAIT_SINGLEAUTH, onfinish);
     return;
   } else if (from == mds->get_nodeid()) {
-    MDSInternalContextBase::vec finished;
+    MDSContext::vec finished;
     base->take_waiting(CInode::WAIT_DIR, finished);
     mds->queue_waiters(finished);
     return;
@@ -9890,7 +9890,7 @@ struct C_MDC_RetryDiscoverPath2 : public MDCacheContext {
 void MDCache::discover_path(CDir *base,
                            snapid_t snap,
                            filepath want_path,
-                           MDSInternalContextBase *onfinish,
+                           MDSContext *onfinish,
                            bool want_xlocked)
 {
   mds_rank_t from = base->authority().first;
@@ -9906,7 +9906,7 @@ void MDCache::discover_path(CDir *base,
     base->add_waiter(CDir::WAIT_SINGLEAUTH, onfinish);
     return;
   } else if (from == mds->get_nodeid()) {
-    MDSInternalContextBase::vec finished;
+    MDSContext::vec finished;
     base->take_sub_waiting(finished);
     mds->queue_waiters(finished);
     return;
@@ -10252,7 +10252,7 @@ void MDCache::handle_discover_reply(const MDiscoverReply::const_ref &m)
   if (m->is_flag_error_dn()) 
     dout(7) << " flag error, dentry = " << m->get_error_dentry() << dendl;
 
-  MDSInternalContextBase::vec finished, error;
+  MDSContext::vec finished, error;
   mds_rank_t from = mds_rank_t(m->get_source().num());
 
   // starting point
@@ -10417,7 +10417,7 @@ void MDCache::replicate_inode(CInode *in, mds_rank_t to, bufferlist& bl,
 }
 
 CDir *MDCache::add_replica_dir(bufferlist::const_iterator& p, CInode *diri, mds_rank_t from,
-                              MDSInternalContextBase::vec& finished)
+                              MDSContext::vec& finished)
 {
   dirfrag_t df;
   decode(df, p);
@@ -10458,7 +10458,7 @@ CDir *MDCache::add_replica_dir(bufferlist::const_iterator& p, CInode *diri, mds_
   return dir;
 }
 
-CDentry *MDCache::add_replica_dentry(bufferlist::const_iterator& p, CDir *dir, MDSInternalContextBase::vec& finished)
+CDentry *MDCache::add_replica_dentry(bufferlist::const_iterator& p, CDir *dir, MDSContext::vec& finished)
 {
   string name;
   snapid_t last;
@@ -10482,7 +10482,7 @@ CDentry *MDCache::add_replica_dentry(bufferlist::const_iterator& p, CDir *dir, M
   return dn;
 }
 
-CInode *MDCache::add_replica_inode(bufferlist::const_iterator& p, CDentry *dn, MDSInternalContextBase::vec& finished)
+CInode *MDCache::add_replica_inode(bufferlist::const_iterator& p, CDentry *dn, MDSContext::vec& finished)
 {
   inodeno_t ino;
   snapid_t last;
@@ -10529,7 +10529,7 @@ void MDCache::replicate_stray(CDentry *straydn, mds_rank_t who, bufferlist& bl)
    
 CDentry *MDCache::add_replica_stray(const bufferlist &bl, mds_rank_t from)
 {
-  MDSInternalContextBase::vec finished;
+  MDSContext::vec finished;
   auto p = bl.cbegin();
 
   CInode *mdsin = add_replica_inode(p, NULL, finished);
@@ -10681,7 +10681,7 @@ void MDCache::handle_dentry_link(const MDentryLink::const_ref &m)
   }
 
   auto p = m->bl.cbegin();
-  MDSInternalContextBase::vec finished;
+  MDSContext::vec finished;
   if (dn) {
     if (m->get_is_primary()) {
       // primary link.
@@ -10830,7 +10830,7 @@ void MDCache::handle_dentry_unlink(const MDentryUnlink::const_ref &m)
  */
 void MDCache::adjust_dir_fragments(CInode *diri, frag_t basefrag, int bits,
                                   list<CDir*>& resultfrags, 
-                                  MDSInternalContextBase::vec& waiters,
+                                  MDSContext::vec& waiters,
                                   bool replay)
 {
   dout(10) << "adjust_dir_fragments " << basefrag << " " << bits 
@@ -10851,7 +10851,7 @@ CDir *MDCache::force_dir_fragment(CInode *diri, frag_t fg, bool replay)
   dout(10) << "force_dir_fragment " << fg << " on " << *diri << dendl;
 
   list<CDir*> src, result;
-  MDSInternalContextBase::vec waiters;
+  MDSContext::vec waiters;
 
   // split a parent?
   frag_t parent = diri->dirfragtree.get_branch_or_leaf(fg);
@@ -10896,7 +10896,7 @@ void MDCache::adjust_dir_fragments(CInode *diri,
                                   list<CDir*>& srcfrags,
                                   frag_t basefrag, int bits,
                                   list<CDir*>& resultfrags, 
-                                  MDSInternalContextBase::vec& waiters,
+                                  MDSContext::vec& waiters,
                                   bool replay)
 {
   dout(10) << "adjust_dir_fragments " << basefrag << " bits " << bits
@@ -11497,7 +11497,7 @@ void MDCache::dispatch_fragment_dir(MDRequestRef& mdr)
   }
 
   // refragment
-  MDSInternalContextBase::vec waiters;
+  MDSContext::vec waiters;
   adjust_dir_fragments(diri, info.dirs, basedirfrag.frag, info.bits,
                       info.resultfrags, waiters, false);
   if (g_conf()->mds_debug_frag)
@@ -11808,7 +11808,7 @@ void MDCache::handle_fragment_notify(const MMDSFragmentNotify::const_ref &notify
 */
 
     // refragment
-    MDSInternalContextBase::vec waiters;
+    MDSContext::vec waiters;
     list<CDir*> resultfrags;
     adjust_dir_fragments(diri, base, bits, resultfrags, waiters, false);
     if (g_conf()->mds_debug_frag)
@@ -11910,7 +11910,7 @@ void MDCache::rollback_uncommitted_fragments()
     list<CDir*> resultfrags;
     if (uf.old_frags.empty()) {
       // created by old format EFragment
-      MDSInternalContextBase::vec waiters;
+      MDSContext::vec waiters;
       adjust_dir_fragments(diri, p->first.frag, -uf.bits, resultfrags, waiters, true);
     } else {
       auto bp = uf.rollback.cbegin();
@@ -12784,7 +12784,7 @@ void MDCache::flush_dentry(std::string_view path, Context *fin)
   flush_dentry_work(mdr);
 }
 
-class C_FinishIOMDR : public MDSInternalContextBase {
+class C_FinishIOMDR : public MDSContext {
 protected:
   MDSRank *mds;
   MDRequestRef mdr;
index 9679eccc4e6ed2f4988a4f68e70fb761ae5b932c..172ad8d9b291501fc45fa8e59225d9489ca9a774 100644 (file)
@@ -291,14 +291,14 @@ public:
   }
 
   // waiters
-  map<int, map<inodeno_t, MDSInternalContextBase::vec > > waiting_for_base_ino;
+  map<int, map<inodeno_t, MDSContext::vec > > waiting_for_base_ino;
 
-  void discover_base_ino(inodeno_t want_ino, MDSInternalContextBase *onfinish, mds_rank_t from=MDS_RANK_NONE);
-  void discover_dir_frag(CInode *base, frag_t approx_fg, MDSInternalContextBase *onfinish,
+  void discover_base_ino(inodeno_t want_ino, MDSContext *onfinish, mds_rank_t from=MDS_RANK_NONE);
+  void discover_dir_frag(CInode *base, frag_t approx_fg, MDSContext *onfinish,
                         mds_rank_t from=MDS_RANK_NONE);
-  void discover_path(CInode *base, snapid_t snap, filepath want_path, MDSInternalContextBase *onfinish,
+  void discover_path(CInode *base, snapid_t snap, filepath want_path, MDSContext *onfinish,
                     bool want_xlocked=false, mds_rank_t from=MDS_RANK_NONE);
-  void discover_path(CDir *base, snapid_t snap, filepath want_path, MDSInternalContextBase *onfinish,
+  void discover_path(CDir *base, snapid_t snap, filepath want_path, MDSContext *onfinish,
                     bool want_xlocked=false);
   void kick_discovers(mds_rank_t who);  // after a failure.
 
@@ -420,7 +420,7 @@ public:
     uncommitted_masters[reqid].slaves = slaves;
     uncommitted_masters[reqid].safe = safe;
   }
-  void wait_for_uncommitted_master(metareqid_t reqid, MDSInternalContextBase *c) {
+  void wait_for_uncommitted_master(metareqid_t reqid, MDSContext *c) {
     uncommitted_masters[reqid].waiters.push_back(c);
   }
   bool have_uncommitted_master(metareqid_t reqid, mds_rank_t from) {
@@ -459,7 +459,7 @@ protected:
   struct umaster {
     set<mds_rank_t> slaves;
     LogSegment *ls;
-    MDSInternalContextBase::vec waiters;
+    MDSContext::vec waiters;
     bool safe;
     bool committing;
     bool recovering;
@@ -533,7 +533,7 @@ public:
   }
   void cancel_ambiguous_import(CDir *);
   void finish_ambiguous_import(dirfrag_t dirino);
-  void resolve_start(MDSInternalContext *resolve_done_);
+  void resolve_start(MDSContext *resolve_done_);
   void send_resolves();
   void maybe_send_pending_resolves() {
     if (resolves_pending)
@@ -566,7 +566,7 @@ protected:
 
   map<inodeno_t,map<client_t,map<mds_rank_t,cap_reconnect_t> > > cap_imports;  // ino -> client -> frommds -> capex
   set<inodeno_t> cap_imports_missing;
-  map<inodeno_t, MDSInternalContextBase::vec > cap_reconnect_waiters;
+  map<inodeno_t, MDSContext::vec > cap_reconnect_waiters;
   int cap_imports_num_opening;
   
   set<CInode*> rejoin_undef_inodes;
@@ -576,7 +576,7 @@ protected:
 
   vector<CInode*> rejoin_recover_q, rejoin_check_q;
   list<SimpleLock*> rejoin_eval_locks;
-  MDSInternalContextBase::vec rejoin_waiters;
+  MDSContext::vec rejoin_waiters;
 
   void rejoin_walk(CDir *dir, const MMDSCacheRejoin::ref &rejoin);
   void handle_cache_rejoin(const MMDSCacheRejoin::const_ref &m);
@@ -594,10 +594,10 @@ protected:
     if (rejoins_pending)
       rejoin_send_rejoins();
   }
-  std::unique_ptr<MDSInternalContext> rejoin_done;
-  std::unique_ptr<MDSInternalContext> resolve_done;
+  std::unique_ptr<MDSContext> rejoin_done;
+  std::unique_ptr<MDSContext> resolve_done;
 public:
-  void rejoin_start(MDSInternalContext *rejoin_done_);
+  void rejoin_start(MDSContext *rejoin_done_);
   void rejoin_gather_finish();
   void rejoin_send_rejoins();
   void rejoin_export_caps(inodeno_t ino, client_t client, const cap_reconnect_t& icr,
@@ -636,7 +636,7 @@ public:
     ceph_assert(cap_imports[ino][client].size() == 1);
     cap_imports.erase(ino);
   }
-  void wait_replay_cap_reconnect(inodeno_t ino, MDSInternalContextBase *c) {
+  void wait_replay_cap_reconnect(inodeno_t ino, MDSContext *c) {
     cap_reconnect_waiters[ino].push_back(c);
   }
 
@@ -911,7 +911,7 @@ protected:
 
 private:
   bool opening_root, open;
-  MDSInternalContextBase::vec waiting_for_open;
+  MDSContext::vec waiting_for_open;
 
 public:
   void init_layouts();
@@ -924,21 +924,21 @@ public:
   void create_mydir_hierarchy(MDSGather *gather);
 
   bool is_open() { return open; }
-  void wait_for_open(MDSInternalContextBase *c) {
+  void wait_for_open(MDSContext *c) {
     waiting_for_open.push_back(c);
   }
 
-  void open_root_inode(MDSInternalContextBase *c);
+  void open_root_inode(MDSContext *c);
   void open_root();
-  void open_mydir_inode(MDSInternalContextBase *c);
-  void open_mydir_frag(MDSInternalContextBase *c);
+  void open_mydir_inode(MDSContext *c);
+  void open_mydir_frag(MDSContext *c);
   void populate_mydir();
 
-  void _create_system_file(CDir *dir, std::string_view name, CInode *in, MDSInternalContextBase *fin);
+  void _create_system_file(CDir *dir, std::string_view name, CInode *in, MDSContext *fin);
   void _create_system_file_finish(MutationRef& mut, CDentry *dn,
-                                  version_t dpv, MDSInternalContextBase *fin);
+                                  version_t dpv, MDSContext *fin);
 
-  void open_foreign_mdsdir(inodeno_t ino, MDSInternalContextBase *c);
+  void open_foreign_mdsdir(inodeno_t ino, MDSContext *c);
   CDir *get_stray_dir(CInode *in);
   CDentry *get_or_create_stray_dentry(CInode *in);
 
@@ -980,7 +980,7 @@ public:
 
   CInode *cache_traverse(const filepath& path);
 
-  void open_remote_dirfrag(CInode *diri, frag_t fg, MDSInternalContextBase *fin);
+  void open_remote_dirfrag(CInode *diri, frag_t fg, MDSContext *fin);
   CInode *get_dentry_inode(CDentry *dn, MDRequestRef& mdr, bool projected=false);
 
   bool parallel_fetch(map<inodeno_t,filepath>& pathmap, set<inodeno_t>& missing);
@@ -988,9 +988,9 @@ public:
                                   set<CDir*>& fetch_queue, set<inodeno_t>& missing,
                                   C_GatherBuilder &gather_bld);
 
-  void open_remote_dentry(CDentry *dn, bool projected, MDSInternalContextBase *fin,
+  void open_remote_dentry(CDentry *dn, bool projected, MDSContext *fin,
                          bool want_xlocked=false);
-  void _open_remote_dentry_finish(CDentry *dn, inodeno_t ino, MDSInternalContextBase *fin,
+  void _open_remote_dentry_finish(CDentry *dn, inodeno_t ino, MDSContext *fin,
                                  bool want_xlocked, int r);
 
   void make_trace(vector<CDentry*>& trace, CInode *in);
@@ -1009,7 +1009,7 @@ protected:
     version_t tid;
     int64_t pool;
     int last_err;
-    MDSInternalContextBase::vec waiters;
+    MDSContext::vec waiters;
     open_ino_info_t() : checking(MDS_RANK_NONE), auth_hint(MDS_RANK_NONE),
       check_peers(true), fetch_backtrace(true), discover(false),
       want_replica(false), want_xlocked(false), tid(0), pool(-1),
@@ -1036,14 +1036,14 @@ protected:
 
 public:
   void kick_open_ino_peers(mds_rank_t who);
-  void open_ino(inodeno_t ino, int64_t pool, MDSInternalContextBase *fin,
+  void open_ino(inodeno_t ino, int64_t pool, MDSContext *fin,
                bool want_replica=true, bool want_xlocked=false);
   
   // -- find_ino_peer --
   struct find_ino_peer_info_t {
     inodeno_t ino;
     ceph_tid_t tid;
-    MDSInternalContextBase *fin;
+    MDSContext *fin;
     mds_rank_t hint;
     mds_rank_t checking;
     set<mds_rank_t> checked;
@@ -1054,7 +1054,7 @@ public:
   map<ceph_tid_t, find_ino_peer_info_t> find_ino_peer;
   ceph_tid_t find_ino_peer_last_tid;
 
-  void find_ino_peers(inodeno_t ino, MDSInternalContextBase *c, mds_rank_t hint=MDS_RANK_NONE);
+  void find_ino_peers(inodeno_t ino, MDSContext *c, mds_rank_t hint=MDS_RANK_NONE);
   void _do_find_ino_peer(find_ino_peer_info_t& fip);
   void handle_find_ino(const MMDSFindIno::const_ref &m);
   void handle_find_ino_reply(const MMDSFindInoReply::const_ref &m);
@@ -1098,9 +1098,9 @@ public:
   void replicate_inode(CInode *in, mds_rank_t to, bufferlist& bl,
                       uint64_t features);
   
-  CDir* add_replica_dir(bufferlist::const_iterator& p, CInode *diri, mds_rank_t from, MDSInternalContextBase::vec& finished);
-  CDentry *add_replica_dentry(bufferlist::const_iterator& p, CDir *dir, MDSInternalContextBase::vec& finished);
-  CInode *add_replica_inode(bufferlist::const_iterator& p, CDentry *dn, MDSInternalContextBase::vec& finished);
+  CDir* add_replica_dir(bufferlist::const_iterator& p, CInode *diri, mds_rank_t from, MDSContext::vec& finished);
+  CDentry *add_replica_dentry(bufferlist::const_iterator& p, CDir *dir, MDSContext::vec& finished);
+  CInode *add_replica_inode(bufferlist::const_iterator& p, CDentry *dn, MDSContext::vec& finished);
 
   void replicate_stray(CDentry *straydn, mds_rank_t who, bufferlist& bl);
   CDentry *add_replica_stray(const bufferlist &bl, mds_rank_t from);
@@ -1120,7 +1120,7 @@ private:
     int bits;
     bool committed;
     LogSegment *ls;
-    MDSInternalContextBase::vec waiters;
+    MDSContext::vec waiters;
     frag_vec_t old_frags;
     bufferlist rollback;
     ufragment() : bits(0), committed(false), ls(NULL) {}
@@ -1148,12 +1148,12 @@ private:
   typedef map<dirfrag_t,fragment_info_t>::iterator fragment_info_iterator;
 
   void adjust_dir_fragments(CInode *diri, frag_t basefrag, int bits,
-                           list<CDir*>& frags, MDSInternalContextBase::vec& waiters, bool replay);
+                           list<CDir*>& frags, MDSContext::vec& waiters, bool replay);
   void adjust_dir_fragments(CInode *diri,
                            list<CDir*>& srcfrags,
                            frag_t basefrag, int bits,
                            list<CDir*>& resultfrags, 
-                           MDSInternalContextBase::vec& waiters,
+                           MDSContext::vec& waiters,
                            bool replay);
   CDir *force_dir_fragment(CInode *diri, frag_t fg, bool replay=true);
   void get_force_dirfrag_bound_set(const vector<dirfrag_t>& dfs, set<CDir*>& bounds);
@@ -1191,7 +1191,7 @@ private:
   DecayCounter trim_counter;
 
 public:
-  void wait_for_uncommitted_fragment(dirfrag_t dirfrag, MDSInternalContextBase *c) {
+  void wait_for_uncommitted_fragment(dirfrag_t dirfrag, MDSContext *c) {
     ceph_assert(uncommitted_fragments.count(dirfrag));
     uncommitted_fragments[dirfrag].waiters.push_back(c);
   }
index e6effef2ed6014358f00dd21bf9a0cb36f0e3ced..9c08232f540e38d543df8aa1d4ec74cda7ff03e7 100644 (file)
@@ -121,7 +121,7 @@ class C_MDL_WriteError : public MDSIOContextBase {
 };
 
 
-void MDLog::write_head(MDSInternalContextBase *c) 
+void MDLog::write_head(MDSContext *c) 
 {
   Context *fin = NULL;
   if (c != NULL) {
@@ -147,7 +147,7 @@ uint64_t MDLog::get_safe_pos() const
 
 
 
-void MDLog::create(MDSInternalContextBase *c)
+void MDLog::create(MDSContext *c)
 {
   dout(5) << "create empty log" << dendl;
 
@@ -184,7 +184,7 @@ void MDLog::create(MDSInternalContextBase *c)
   submit_thread.create("md_submit");
 }
 
-void MDLog::open(MDSInternalContextBase *c)
+void MDLog::open(MDSContext *c)
 {
   dout(5) << "open discovering log bounds" << dendl;
 
@@ -202,9 +202,9 @@ void MDLog::open(MDSInternalContextBase *c)
  */
 class C_ReopenComplete : public MDSInternalContext {
   MDLog *mdlog;
-  MDSInternalContextBase *on_complete;
+  MDSContext *on_complete;
 public:
-  C_ReopenComplete(MDLog *mdlog_, MDSInternalContextBase *on_complete_) : MDSInternalContext(mdlog_->mds), mdlog(mdlog_), on_complete(on_complete_) {}
+  C_ReopenComplete(MDLog *mdlog_, MDSContext *on_complete_) : MDSInternalContext(mdlog_->mds), mdlog(mdlog_), on_complete(on_complete_) {}
   void finish(int r) override {
     mdlog->append();
     on_complete->complete(r);
@@ -216,7 +216,7 @@ public:
  * recovery procedure again, potentially reformatting the journal if it
  * was in an old format.
  */
-void MDLog::reopen(MDSInternalContextBase *c)
+void MDLog::reopen(MDSContext *c)
 {
   dout(5) << "reopen" << dendl;
 
@@ -335,7 +335,7 @@ class C_MDL_Flushed : public MDSLogContextBase {
 protected:
   MDLog *mdlog;
   MDSRank *get_mds() override {return mdlog->mds;}
-  MDSInternalContextBase *wrapped;
+  MDSContext *wrapped;
 
   void finish(int r) override {
     if (wrapped)
@@ -343,7 +343,7 @@ protected:
   }
 
 public:
-  C_MDL_Flushed(MDLog *m, MDSInternalContextBase *w)
+  C_MDL_Flushed(MDLog *m, MDSContext *w)
     : mdlog(m), wrapped(w) {}
   C_MDL_Flushed(MDLog *m, uint64_t wp) : mdlog(m), wrapped(NULL) {
     set_write_pos(wp);
@@ -419,8 +419,8 @@ void MDLog::_submit_thread()
       delete le;
     } else {
       if (data.fin) {
-       MDSInternalContextBase* fin =
-               dynamic_cast<MDSInternalContextBase*>(data.fin);
+       MDSContext* fin =
+               dynamic_cast<MDSContext*>(data.fin);
        ceph_assert(fin);
        C_MDL_Flushed *fin2 = new C_MDL_Flushed(this, fin);
        fin2->set_write_pos(journaler->get_write_pos());
@@ -440,7 +440,7 @@ void MDLog::_submit_thread()
   submit_mutex.Unlock();
 }
 
-void MDLog::wait_for_safe(MDSInternalContextBase *c)
+void MDLog::wait_for_safe(MDSContext *c)
 {
   submit_mutex.Lock();
 
@@ -561,7 +561,7 @@ void MDLog::_prepare_new_segment()
   mds->mdcache->advance_stray();
 }
 
-void MDLog::_journal_segment_subtree_map(MDSInternalContextBase *onsync)
+void MDLog::_journal_segment_subtree_map(MDSContext *onsync)
 {
   ceph_assert(submit_mutex.is_locked_by_me());
 
@@ -892,7 +892,7 @@ void MDLog::_expired(LogSegment *ls)
 
 
 
-void MDLog::replay(MDSInternalContextBase *c)
+void MDLog::replay(MDSContext *c)
 {
   ceph_assert(journaler->is_active());
   ceph_assert(journaler->is_readonly());
@@ -941,7 +941,7 @@ void MDLog::replay(MDSInternalContextBase *c)
  * When this function completes, the `journaler` attribute will be set to
  * a Journaler instance using the latest available serialization format.
  */
-void MDLog::_recovery_thread(MDSInternalContextBase *completion)
+void MDLog::_recovery_thread(MDSContext *completion)
 {
   ceph_assert(journaler == NULL);
   if (g_conf()->mds_journal_format > JOURNAL_FORMAT_MAX) {
@@ -1102,7 +1102,7 @@ void MDLog::_recovery_thread(MDSInternalContextBase *completion)
  * swapping pointers to make that one the front journal only when we have
  * safely completed.
  */
-void MDLog::_reformat_journal(JournalPointer const &jp_in, Journaler *old_journal, MDSInternalContextBase *completion)
+void MDLog::_reformat_journal(JournalPointer const &jp_in, Journaler *old_journal, MDSContext *completion)
 {
   ceph_assert(!jp_in.is_null());
   ceph_assert(completion != NULL);
index 6e37e9c7845cf7d927842278862fe1e0e5a8bed4..7fe127d0d63ed7edd63d9ff78959b696607df879 100644 (file)
@@ -100,7 +100,7 @@ protected:
   friend class ReplayThread;
   friend class C_MDL_Replay;
 
-  MDSInternalContextBase::vec waitfor_replay;
+  MDSContext::vec waitfor_replay;
 
   void _replay();         // old way
   void _replay_thread();  // new way
@@ -108,17 +108,17 @@ protected:
   // Journal recovery/rewrite logic
   class RecoveryThread : public Thread {
     MDLog *log;
-    MDSInternalContextBase *completion;
+    MDSContext *completion;
   public:
-    void set_completion(MDSInternalContextBase *c) {completion = c;}
+    void set_completion(MDSContext *c) {completion = c;}
     explicit RecoveryThread(MDLog *l) : log(l), completion(NULL) {}
     void* entry() override {
       log->_recovery_thread(completion);
       return 0;
     }
   } recovery_thread;
-  void _recovery_thread(MDSInternalContextBase *completion);
-  void _reformat_journal(JournalPointer const &jp, Journaler *old_journal, MDSInternalContextBase *completion);
+  void _recovery_thread(MDSContext *completion);
+  void _reformat_journal(JournalPointer const &jp, Journaler *old_journal, MDSContext *completion);
 
   // -- segments --
   map<uint64_t,LogSegment*> segments;
@@ -215,7 +215,7 @@ private:
   // -- segments --
   void _start_new_segment();
   void _prepare_new_segment();
-  void _journal_segment_subtree_map(MDSInternalContextBase *onsync);
+  void _journal_segment_subtree_map(MDSContext *onsync);
 public:
   void start_new_segment() {
     std::lock_guard l(submit_mutex);
@@ -225,7 +225,7 @@ public:
     std::lock_guard l(submit_mutex);
     _prepare_new_segment();
   }
-  void journal_segment_subtree_map(MDSInternalContextBase *onsync=NULL) {
+  void journal_segment_subtree_map(MDSContext *onsync=NULL) {
     submit_mutex.Lock();
     _journal_segment_subtree_map(onsync);
     submit_mutex.Unlock();
@@ -293,7 +293,7 @@ public:
   }
   bool entry_is_open() const { return cur_event != NULL; }
 
-  void wait_for_safe( MDSInternalContextBase *c );
+  void wait_for_safe( MDSContext *c );
   void flush();
   bool is_flushed() const {
     return unflushed == 0;
@@ -319,14 +319,14 @@ public:
   };
 
 private:
-  void write_head(MDSInternalContextBase *onfinish);
+  void write_head(MDSContext *onfinish);
 
 public:
-  void create(MDSInternalContextBase *onfinish);  // fresh, empty log! 
-  void open(MDSInternalContextBase *onopen);      // append() or replay() to follow!
-  void reopen(MDSInternalContextBase *onopen);
+  void create(MDSContext *onfinish);  // fresh, empty log! 
+  void open(MDSContext *onopen);      // append() or replay() to follow!
+  void reopen(MDSContext *onopen);
   void append();
-  void replay(MDSInternalContextBase *onfinish);
+  void replay(MDSContext *onfinish);
 
   void standby_trim_segments();
 
index e403c7f352f390182c55de31736d0d415619fa47..3ad8190b0b2499eb84d81c8566f47bdbe3593fbd 100644 (file)
@@ -8,7 +8,7 @@
 uint64_t MDSCacheObject::last_wait_seq = 0;
 
 void MDSCacheObject::finish_waiting(uint64_t mask, int result) {
-  MDSInternalContextBase::vec finished;
+  MDSContext::vec finished;
   take_waiting(mask, finished);
   finish_contexts(g_ceph_context, finished, result);
 }
index 3b6867b3b2539fe7ce1e4f0b8fb2d1fe34ac5dd5..e17089bbd8c4ecfca37fb1663855bfeddb40718a 100644 (file)
@@ -23,7 +23,7 @@
 class MLock;
 class SimpleLock;
 class MDSCacheObject;
-class MDSInternalContextBase;
+class MDSContext;
 
 /*
  * for metadata leases to clients
@@ -307,7 +307,7 @@ public:
   // ---------------------------------------------
   // waiting
  private:
-  mempool::mds_co::compact_multimap<uint64_t, std::pair<uint64_t, MDSInternalContextBase*>> waiting;
+  mempool::mds_co::compact_multimap<uint64_t, std::pair<uint64_t, MDSContext*>> waiting;
   static uint64_t last_wait_seq;
 
  public:
@@ -323,7 +323,7 @@ public:
     }
     return false;
   }
-  virtual void add_waiter(uint64_t mask, MDSInternalContextBase *c) {
+  virtual void add_waiter(uint64_t mask, MDSContext *c) {
     if (waiting.empty())
       get(PIN_WAITER);
 
@@ -332,20 +332,20 @@ public:
       seq = ++last_wait_seq;
       mask &= ~WAIT_ORDERED;
     }
-    waiting.insert(pair<uint64_t, pair<uint64_t, MDSInternalContextBase*> >(
+    waiting.insert(pair<uint64_t, pair<uint64_t, MDSContext*> >(
                            mask,
-                           pair<uint64_t, MDSInternalContextBase*>(seq, c)));
+                           pair<uint64_t, MDSContext*>(seq, c)));
 //    pdout(10,g_conf()->debug_mds) << (mdsco_db_line_prefix(this)) 
 //                            << "add_waiter " << hex << mask << dec << " " << c
 //                            << " on " << *this
 //                            << dendl;
     
   }
-  virtual void take_waiting(uint64_t mask, MDSInternalContextBase::vec& ls) {
+  virtual void take_waiting(uint64_t mask, MDSContext::vec& ls) {
     if (waiting.empty()) return;
 
     // process ordered waiters in the same order that they were added.
-    std::map<uint64_t, MDSInternalContextBase*> ordered_waiters;
+    std::map<uint64_t, MDSContext*> ordered_waiters;
 
     for (auto it = waiting.begin(); it != waiting.end(); ) {
       if (it->first & mask) {
@@ -386,7 +386,7 @@ public:
   virtual void encode_lock_state(int type, bufferlist& bl) { ceph_abort(); }
   virtual void decode_lock_state(int type, const bufferlist& bl) { ceph_abort(); }
   virtual void finish_lock_waiters(int type, uint64_t mask, int r=0) { ceph_abort(); }
-  virtual void add_lock_waiter(int type, uint64_t mask, MDSInternalContextBase *c) { ceph_abort(); }
+  virtual void add_lock_waiter(int type, uint64_t mask, MDSContext *c) { ceph_abort(); }
   virtual bool is_lock_waiting(int type, uint64_t mask) { ceph_abort(); return false; }
 
   virtual void clear_dirty_scattered(int type) { ceph_abort(); }
index d2b0b9bbbeca1ef19f2896073f42feb6b86d098c..f520737e454fcb7a0d1ca4907e3cb6ee805d4d9b 100644 (file)
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_mds
 
-void MDSInternalContextBase::complete(int r) {
+void MDSContext::complete(int r) {
   MDSRank *mds = get_mds();
-
-  dout(10) << "MDSInternalContextBase::complete: " << typeid(*this).name() << dendl;
-  ceph_assert(mds != NULL);
+  ceph_assert(mds != nullptr);
   ceph_assert(mds->mds_lock.is_locked_by_me());
-  MDSContext::complete(r);
-}
-
-
-MDSRank *MDSInternalContext::get_mds() {
-  return mds;
-}
-
-MDSRank *MDSInternalContextWrapper::get_mds()
-{
-  return mds;
+  dout(10) << "MDSContext::complete: " << typeid(*this).name() << dendl;
+  return Context::complete(r);
 }
 
 void MDSInternalContextWrapper::finish(int r)
@@ -126,14 +115,6 @@ void MDSLogContextBase::complete(int r) {
   mdlog->set_safe_pos(safe_pos);
 }
 
-MDSRank *MDSIOContext::get_mds() {
-  return mds;
-}
-
-MDSRank *MDSIOContextWrapper::get_mds() {
-  return mds;
-}
-
 void MDSIOContextWrapper::finish(int r)
 {
   fin->complete(r);
@@ -148,10 +129,3 @@ void C_IO_Wrapper::complete(int r)
     MDSIOContext::complete(r);
   }
 }
-
-MDSRank *MDSInternalContextGather::get_mds()
-{
-  derr << "Forbidden call to MDSInternalContextGather::get_mds by " << typeid(*this).name() << dendl;
-  ceph_abort();
-}
-
index 6b9bd59e845089b136a0d1edd191113855b3d9a3..78d251ee4b0741cf9ad3445b0f65278cff3ebd32 100644 (file)
@@ -26,7 +26,6 @@
 
 class MDSRank;
 
-
 /**
  * Completion which has access to a reference to the global MDS instance.
  *
@@ -36,57 +35,62 @@ class MDSRank;
  */
 class MDSContext : public Context
 {
-protected:
+public:
+template<template<typename> class A>
+  using vec_alloc = std::vector<MDSContext*, A<MDSContext*>>;
+  using vec = vec_alloc<std::allocator>;
+
+template<template<typename> class A>
+  using que_alloc = std::deque<MDSContext*, A<MDSContext*>>;
+  using que = que_alloc<std::allocator>;
+
+  void complete(int r) override;
   virtual MDSRank *get_mds() = 0;
 };
 
-
-/**
- * A context which must be called with the big MDS lock held.  Subclass
- * this with a get_mds implementation.
+/* Children of this could have used multiple inheritance with MDSHolder and
+ * MDSContext but then get_mds() would be ambiguous.
  */
-class MDSInternalContextBase : public MDSContext
+template<class T>
+class MDSHolder : public T
 {
 public:
-    template<template<typename> class A>
-    using vec_alloc = std::vector<MDSInternalContextBase *, A<MDSInternalContextBase *>>;
-    using vec = vec_alloc<std::allocator>;
+  MDSRank* get_mds() override {
+    return mds;
+  }
 
-    template<template<typename> class A>
-    using que_alloc = std::deque<MDSInternalContextBase *, A<MDSInternalContextBase *>>;
-    using que = que_alloc<std::allocator>;
+protected:
+  MDSHolder() = delete;
+  MDSHolder(MDSRank* mds) : mds(mds) {
+    ceph_assert(mds != nullptr);
+  }
 
-    void complete(int r) override;
+  MDSRank* mds;
 };
 
 /**
  * General purpose, lets you pass in an MDS pointer.
  */
-class MDSInternalContext : public MDSInternalContextBase
+class MDSInternalContext : public MDSHolder<MDSContext>
 {
-protected:
-  MDSRank *mds;
-  MDSRank* get_mds() override;
-
 public:
-  explicit MDSInternalContext(MDSRank *mds_) : mds(mds_) {
-    ceph_assert(mds != NULL);
-  }
+  MDSInternalContext() = delete;
+
+protected:
+  explicit MDSInternalContext(MDSRank *mds_) : MDSHolder(mds_) {}
 };
 
 /**
  * Wrap a regular Context up as an Internal context. Useful
  * if you're trying to work with one of our more generic frameworks.
  */
-class MDSInternalContextWrapper : public MDSInternalContextBase
+class MDSInternalContextWrapper : public MDSInternalContext
 {
 protected:
-  MDSRank *mds;
-  Context *fin;
-  MDSRank *get_mds() override;
+  Context *fin = nullptr;
   void finish(int r) override;
 public:
-  MDSInternalContextWrapper(MDSRank *m, Context *c) : mds(m), fin(c) {}
+  MDSInternalContextWrapper(MDSRank *m, Context *c) : MDSInternalContext(m), fin(c) {}
 };
 
 class MDSIOContextBase : public MDSContext
@@ -120,9 +124,9 @@ private:
 class MDSLogContextBase : public MDSIOContextBase
 {
 protected:
-  uint64_t write_pos;
+  uint64_t write_pos = 0;
 public:
-  MDSLogContextBase() : write_pos(0) {}
+  MDSLogContextBase() = default;
   void complete(int r) final;
   void set_write_pos(uint64_t wp) { write_pos = wp; }
   virtual void pre_finish(int r) {}
@@ -135,30 +139,22 @@ public:
  * Completion for an I/O operation, takes big MDSRank lock
  * before executing finish function.
  */
-class MDSIOContext : public MDSIOContextBase
+class MDSIOContext : public MDSHolder<MDSIOContextBase>
 {
-protected:
-  MDSRank *mds;
-  MDSRank* get_mds() override;
-
 public:
-  explicit MDSIOContext(MDSRank *mds_) : mds(mds_) {
-    ceph_assert(mds != NULL);
-  }
+  explicit MDSIOContext(MDSRank *mds_) : MDSHolder(mds_) {}
 };
 
 /**
  * Wrap a regular Context up as an IO Context. Useful
  * if you're trying to work with one of our more generic frameworks.
  */
-class MDSIOContextWrapper : public MDSIOContextBase
+class MDSIOContextWrapper : public MDSHolder<MDSIOContextBase>
 {
 protected:
-  MDSRank *mds;
   Context *fin;
-  MDSRank *get_mds() override;
 public:
-  MDSIOContextWrapper(MDSRank *m, Context *c) : mds(m), fin(c) {}
+  MDSIOContextWrapper(MDSRank *m, Context *c) : MDSHolder(m), fin(c) {}
   void finish(int r) override;
   void print(ostream& out) const override {
     out << "io_context_wrapper(" << fin << ")";
@@ -166,32 +162,33 @@ public:
 };
 
 /**
- * No-op for callers expecting MDSInternalContextBase
+ * No-op for callers expecting MDSInternalContext
  */
-class C_MDSInternalNoop final : public MDSInternalContextBase
+class C_MDSInternalNoop : public MDSContext
 {
-  MDSRank* get_mds() override {ceph_abort();}
 public:
   void finish(int r) override {}
   void complete(int r) override { delete this; }
+protected:
+  MDSRank* get_mds() override final {ceph_abort();}
 };
 
 
 /**
- * This class is used where you have an MDSInternalContextBase but
+ * This class is used where you have an MDSInternalContext but
  * you sometimes want to call it back from an I/O completion.
  */
 class C_IO_Wrapper : public MDSIOContext
 {
 protected:
   bool async;
-  MDSInternalContextBase *wrapped;
+  MDSContext *wrapped;
   void finish(int r) override {
     wrapped->complete(r);
     wrapped = nullptr;
   }
 public:
-  C_IO_Wrapper(MDSRank *mds_, MDSInternalContextBase *wrapped_) :
+  C_IO_Wrapper(MDSRank *mds_, MDSContext *wrapped_) :
     MDSIOContext(mds_), async(true), wrapped(wrapped_) {
     ceph_assert(wrapped != NULL);
   }
@@ -208,19 +205,9 @@ public:
   }
 };
 
+using MDSGather = C_GatherBase<MDSContext, C_MDSInternalNoop>;
+using MDSGatherBuilder = C_GatherBuilderBase<MDSContext, MDSGather>;
 
-/**
- * Gather needs a default-constructable class
- */
-class MDSInternalContextGather : public MDSInternalContextBase
-{
-protected:
-  MDSRank *get_mds() override;
-};
-
-using MDSGather = C_GatherBase<MDSInternalContextBase, MDSInternalContextGather>;
-using MDSGatherBuilder = C_GatherBuilderBase<MDSInternalContextBase, MDSGather>;
-
-using MDSContextFactory = ContextFactory<MDSInternalContextBase>;
+using MDSContextFactory = ContextFactory<MDSContext>;
 
 #endif  // MDS_CONTEXT_H
index 06c320eac5ba52440262eaa347c25b897aef0dc6..97bae912a2a4be9071f243ee5634dd545f35b9cb 100644 (file)
@@ -21,7 +21,7 @@
 class MDSContinuation : public Continuation {
 protected:
   Server *server;
-  MDSInternalContextBase *get_internal_callback(int stage) {
+  MDSContext *get_internal_callback(int stage) {
     return new MDSInternalContextWrapper(server->mds, get_callback(stage));
   }
   MDSIOContextBase *get_io_callback(int stage) {
index cc530bda4d2974b6278e2a91fd9c047f8aa0e95e..810eb0b8fa1d4ad4920a4a8c228e449db187d51f 100644 (file)
@@ -2365,9 +2365,9 @@ void MDSRankDispatcher::handle_mds_map(
   }
 
   {
-    map<epoch_t,MDSInternalContextBase::vec >::iterator p = waiting_for_mdsmap.begin();
+    map<epoch_t,MDSContext::vec >::iterator p = waiting_for_mdsmap.begin();
     while (p != waiting_for_mdsmap.end() && p->first <= mdsmap->get_epoch()) {
-      MDSInternalContextBase::vec ls;
+      MDSContext::vec ls;
       ls.swap(p->second);
       waiting_for_mdsmap.erase(p++);
       queue_waiters(ls);
index b2f2179ae0fd1040fc7d16f545e8ae46b43864df..1bd598b8863114979dac461cd5e7825ab904571b 100644 (file)
@@ -261,7 +261,7 @@ class MDSRank {
     } progress_thread;
 
     list<Message::const_ref> waiting_for_nolaggy;
-    MDSInternalContextBase::que finished_queue;
+    MDSContext::que finished_queue;
     // Dispatch, retry, queues
     int dispatch_depth;
     void inc_dispatch_depth() { ++dispatch_depth; }
@@ -279,12 +279,12 @@ class MDSRank {
 
     ceph_tid_t last_tid;    // for mds-initiated requests (e.g. stray rename)
 
-    MDSInternalContextBase::vec waiting_for_active, waiting_for_replay, waiting_for_rejoin,
+    MDSContext::vec waiting_for_active, waiting_for_replay, waiting_for_rejoin,
                                waiting_for_reconnect, waiting_for_resolve;
-    MDSInternalContextBase::vec waiting_for_any_client_connection;
-    MDSInternalContextBase::que replay_queue;
-    map<mds_rank_t, MDSInternalContextBase::vec > waiting_for_active_peer;
-    map<epoch_t, MDSInternalContextBase::vec > waiting_for_mdsmap;
+    MDSContext::vec waiting_for_any_client_connection;
+    MDSContext::que replay_queue;
+    map<mds_rank_t, MDSContext::vec > waiting_for_active_peer;
+    map<epoch_t, MDSContext::vec > waiting_for_mdsmap;
 
     epoch_t osd_epoch_barrier;
 
@@ -310,18 +310,18 @@ class MDSRank {
     void create_logger();
   public:
 
-    void queue_waiter(MDSInternalContextBase *c) {
+    void queue_waiter(MDSContext *c) {
       finished_queue.push_back(c);
       progress_thread.signal();
     }
-    void queue_waiters(MDSInternalContextBase::vec& ls) {
-      MDSInternalContextBase::vec v;
+    void queue_waiters(MDSContext::vec& ls) {
+      MDSContext::vec v;
       v.swap(ls);
       std::copy(v.begin(), v.end(), std::back_inserter(finished_queue));
       progress_thread.signal();
     }
-    void queue_waiters_front(MDSInternalContextBase::vec& ls) {
-      MDSInternalContextBase::vec v;
+    void queue_waiters_front(MDSContext::vec& ls) {
+      MDSContext::vec v;
       v.swap(ls);
       std::copy(v.rbegin(), v.rend(), std::front_inserter(finished_queue));
       progress_thread.signal();
@@ -393,39 +393,39 @@ class MDSRank {
     void send_message_client(const Message::ref& m, Session* session);
     void send_message(const Message::ref& m, const ConnectionRef& c);
 
-    void wait_for_active_peer(mds_rank_t who, MDSInternalContextBase *c) { 
+    void wait_for_active_peer(mds_rank_t who, MDSContext *c) { 
       waiting_for_active_peer[who].push_back(c);
     }
-    void wait_for_cluster_recovered(MDSInternalContextBase *c) {
+    void wait_for_cluster_recovered(MDSContext *c) {
       ceph_assert(cluster_degraded);
       waiting_for_active_peer[MDS_RANK_NONE].push_back(c);
     }
 
-    void wait_for_any_client_connection(MDSInternalContextBase *c) {
+    void wait_for_any_client_connection(MDSContext *c) {
       waiting_for_any_client_connection.push_back(c);
     }
     void kick_waiters_for_any_client_connection(void) {
       finish_contexts(g_ceph_context, waiting_for_any_client_connection);
     }
-    void wait_for_active(MDSInternalContextBase *c) {
+    void wait_for_active(MDSContext *c) {
       waiting_for_active.push_back(c);
     }
-    void wait_for_replay(MDSInternalContextBase *c) { 
+    void wait_for_replay(MDSContext *c) { 
       waiting_for_replay.push_back(c); 
     }
-    void wait_for_rejoin(MDSInternalContextBase *c) {
+    void wait_for_rejoin(MDSContext *c) {
       waiting_for_rejoin.push_back(c);
     }
-    void wait_for_reconnect(MDSInternalContextBase *c) {
+    void wait_for_reconnect(MDSContext *c) {
       waiting_for_reconnect.push_back(c);
     }
-    void wait_for_resolve(MDSInternalContextBase *c) {
+    void wait_for_resolve(MDSContext *c) {
       waiting_for_resolve.push_back(c);
     }
-    void wait_for_mdsmap(epoch_t e, MDSInternalContextBase *c) {
+    void wait_for_mdsmap(epoch_t e, MDSContext *c) {
       waiting_for_mdsmap[e].push_back(c);
     }
-    void enqueue_replay(MDSInternalContextBase *c) {
+    void enqueue_replay(MDSContext *c) {
       replay_queue.push_back(c);
     }
 
@@ -579,14 +579,14 @@ protected:
  * The finish function calls functions which
  * will put the Message exactly once.*/
 class C_MDS_RetryMessage : public MDSInternalContext {
-protected:
-  Message::const_ref m;
 public:
   C_MDS_RetryMessage(MDSRank *mds, const Message::const_ref &m)
     : MDSInternalContext(mds), m(m) {}
   void finish(int r) override {
-    mds->retry_dispatch(m);
+    get_mds()->retry_dispatch(m);
   }
+protected:
+  Message::const_ref m;
 };
 
 class CF_MDS_RetryMessageFactory : public MDSContextFactory {
@@ -594,7 +594,7 @@ public:
   CF_MDS_RetryMessageFactory(MDSRank *mds, const Message::const_ref &m)
     : mds(mds), m(m) {}
 
-  MDSInternalContextBase *build() {
+  MDSContext *build() {
     return new C_MDS_RetryMessage(mds, m);
   }
 
index 75a5ba32ac931967d24f9decb5a992c962b70443..b0809f50e41d9d622afeb6da3f89c6e4b98df718 100644 (file)
@@ -58,7 +58,7 @@ public:
   }
 };
 
-void MDSTable::save(MDSInternalContextBase *onfinish, version_t v)
+void MDSTable::save(MDSContext *onfinish, version_t v)
 {
   if (v > 0 && v <= committing_version) {
     dout(10) << "save v " << version << " - already saving "
@@ -104,7 +104,7 @@ void MDSTable::save_2(int r, version_t v)
   dout(10) << "save_2 v " << v << dendl;
   committed_version = v;
   
-  MDSInternalContextBase::vec ls;
+  MDSContext::vec ls;
   while (!waitfor_save.empty()) {
     auto it = waitfor_save.begin();
     if (it->first > v) break;
@@ -150,7 +150,7 @@ object_t MDSTable::get_object_name() const
   return object_t(n);
 }
 
-void MDSTable::load(MDSInternalContextBase *onfinish)
+void MDSTable::load(MDSContext *onfinish)
 { 
   dout(10) << "load" << dendl;
 
index a7dfca8d0dad70de9da0cceaa9dd59b2d949d82e..6ad52b2092913550a6146bdfdcbb8b08a390b554 100644 (file)
@@ -40,7 +40,7 @@ protected:
   
   version_t version, committing_version, committed_version, projected_version;
   
-  map<version_t, MDSInternalContextBase::vec > waitfor_save;
+  map<version_t, MDSContext::vec > waitfor_save;
   
 public:
   MDSTable(MDSRank *m, std::string_view n, bool is_per_mds) :
@@ -72,7 +72,7 @@ public:
   bool is_opening() const { return state == STATE_OPENING; }
 
   void reset();
-  void save(MDSInternalContextBase *onfinish=0, version_t need=0);
+  void save(MDSContext *onfinish=0, version_t need=0);
   void save_2(int r, version_t v);
 
   void shutdown() {
@@ -80,7 +80,7 @@ public:
   }
 
   object_t get_object_name() const;
-  void load(MDSInternalContextBase *onfinish);
+  void load(MDSContext *onfinish);
   void load_2(int, bufferlist&, Context *onfinish);
 
   // child must overload these
index 4187fee082f540b6d6be89d27451ec829368bc32..6418b1306d3ab6d32f1285f6bbb596524148c27e 100644 (file)
@@ -77,7 +77,7 @@ void MDSTableClient::handle_request(const MMDSTableRequest::const_ref &m)
 
       ceph_assert(g_conf()->mds_kill_mdstable_at != 3);
 
-      MDSInternalContextBase *onfinish = pending_prepare[reqid].onfinish;
+      MDSContext *onfinish = pending_prepare[reqid].onfinish;
       *pending_prepare[reqid].ptid = tid;
       if (pending_prepare[reqid].pbl)
        *pending_prepare[reqid].pbl = m->bl;
@@ -156,7 +156,7 @@ void MDSTableClient::_logged_ack(version_t tid)
 }
 
 void MDSTableClient::_prepare(bufferlist& mutation, version_t *ptid, bufferlist *pbl,
-                             MDSInternalContextBase *onfinish)
+                             MDSContext *onfinish)
 {
   if (last_reqid == ~0ULL) {
     dout(10) << "tableserver is not ready yet, waiting for request id" << dendl;
index c09b54b2fd187442269996097e233f7a5d4fe379..f2bf461ad9418e605d5e8340750d1260a66a70f2 100644 (file)
@@ -35,13 +35,13 @@ protected:
 
   // prepares
   struct _pending_prepare {
-    MDSInternalContextBase *onfinish;
+    MDSContext *onfinish;
     version_t *ptid;
     bufferlist *pbl; 
     bufferlist mutation;
 
     _pending_prepare() : onfinish(0), ptid(0), pbl(0) {}
-    _pending_prepare(MDSInternalContextBase *c, version_t *pt, bufferlist *pb, bufferlist& m) :
+    _pending_prepare(MDSContext *c, version_t *pt, bufferlist *pb, bufferlist& m) :
       onfinish(c), ptid(pt), pbl(pb), mutation(m) {}
   };
 
@@ -51,7 +51,7 @@ protected:
 
   // pending commits
   map<version_t, LogSegment*> pending_commit;
-  map<version_t, MDSInternalContextBase::vec > ack_waiters;
+  map<version_t, MDSContext::vec > ack_waiters;
 
   void handle_reply(class MMDSTableQuery *m);  
   void _logged_ack(version_t tid);
@@ -64,7 +64,7 @@ public:
 
   void handle_request(const MMDSTableRequest::const_ref &m);
 
-  void _prepare(bufferlist& mutation, version_t *ptid, bufferlist *pbl, MDSInternalContextBase *onfinish);
+  void _prepare(bufferlist& mutation, version_t *ptid, bufferlist *pbl, MDSContext *onfinish);
   void commit(version_t tid, LogSegment *ls);
 
   void resend_commits();
@@ -77,7 +77,7 @@ public:
   bool has_committed(version_t tid) const {
     return pending_commit.count(tid) == 0;
   }
-  void wait_for_ack(version_t tid, MDSInternalContextBase *c) {
+  void wait_for_ack(version_t tid, MDSContext *c) {
     ack_waiters[tid].push_back(c);
   }
 
index ffba78c0ef2540d7c6a3881c53c8fc3f99b43535..cd7724f5e0317585553206d7597375dc8ccfa043 100644 (file)
@@ -257,7 +257,7 @@ void MDSTableServer::_server_update_logged(bufferlist& bl)
 
 // recovery
 
-class C_ServerRecovery : public MDSInternalContextBase {
+class C_ServerRecovery : public MDSContext {
   MDSTableServer *server;
   MDSRank *get_mds() override { return server->mds; }
 public:
index 74c1ca382e43133fb9c4f3a75e359d0a74736765..83f1031551ee4fa540f4c9d0b5a76f7e23835b76 100644 (file)
@@ -33,7 +33,7 @@ private:
     set<mds_rank_t> notify_ack_gather;
     mds_rank_t mds;
     MMDSTableRequest::ref reply;
-    MDSInternalContextBase *onfinish;
+    MDSContext *onfinish;
     notify_info_t() : reply(NULL), onfinish(NULL) {}
   };
   map<version_t, notify_info_t> pending_notifies;
index 1d777ff6e4e6b8c0a2efc8a4d999e0f0e29304b7..847e2e0d47e10c253719cda39559fa8a6aad01b1 100644 (file)
@@ -67,7 +67,7 @@
 #define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".migrator "
 
 
-class MigratorContext : public MDSInternalContextBase {
+class MigratorContext : public MDSContext {
 protected:
   Migrator *mig;
   MDSRank *get_mds() override {
@@ -1665,7 +1665,7 @@ void Migrator::finish_export_inode_caps(CInode *in, mds_rank_t peer,
 
 void Migrator::finish_export_inode(CInode *in, mds_rank_t peer,
                                   map<client_t,Capability::Import>& peer_imported,
-                                  MDSInternalContextBase::vec& finished)
+                                  MDSContext::vec& finished)
 {
   dout(12) << "finish_export_inode " << *in << dendl;
 
@@ -1802,7 +1802,7 @@ uint64_t Migrator::encode_export_dir(bufferlist& exportbl,
 
 void Migrator::finish_export_dir(CDir *dir, mds_rank_t peer,
                                 map<inodeno_t,map<client_t,Capability::Import> >& peer_imported,
-                                MDSInternalContextBase::vec& finished, int *num_dentries)
+                                MDSContext::vec& finished, int *num_dentries)
 {
   dout(10) << "finish_export_dir " << *dir << dendl;
 
@@ -2142,7 +2142,7 @@ void Migrator::export_finish(CDir *dir)
   
   // finish export (adjust local cache state)
   int num_dentries = 0;
-  MDSInternalContextBase::vec finished;
+  MDSContext::vec finished;
   finish_export_dir(dir, it->second.peer,
                    it->second.peer_imported, finished, &num_dentries);
 
@@ -2228,7 +2228,7 @@ private:
 class C_MDS_ExportDiscoverFactory : public MDSContextFactory {
 public:
   C_MDS_ExportDiscoverFactory(Migrator *mig, MExportDirDiscover::const_ref m) : mig(mig), m(m) {}
-  MDSInternalContextBase *build() {
+  MDSContext *build() {
     return new C_MDS_ExportDiscover(mig, m);
   }
 private:
@@ -2381,7 +2381,7 @@ private:
 class C_MDS_ExportPrepFactory : public MDSContextFactory {
 public:
   C_MDS_ExportPrepFactory(Migrator *mig, MExportDirPrep::const_ref m) : mig(mig), m(m) {}
-  MDSInternalContextBase *build() {
+  MDSContext *build() {
     return new C_MDS_ExportPrep(mig, m);
   }
 private:
@@ -2396,7 +2396,7 @@ void Migrator::handle_export_prep(const MExportDirPrep::const_ref &m, bool did_a
 
   CDir *dir;
   CInode *diri;
-  MDSInternalContextBase::vec finished;
+  MDSContext::vec finished;
 
   // assimilate root dir.
   map<dirfrag_t,import_state_t>::iterator it = import_state.find(m->get_dirfrag());
@@ -2738,7 +2738,7 @@ void Migrator::import_remove_pins(CDir *dir, set<CDir*>& bounds)
 
 class C_MDC_QueueContexts : public MigratorContext {
 public:
-  MDSInternalContextBase::vec contexts;
+  MDSContext::vec contexts;
   C_MDC_QueueContexts(Migrator *m) : MigratorContext(m) {}
   void finish(int r) override {
     // execute contexts immediately after 'this' context
@@ -3304,7 +3304,7 @@ int Migrator::decode_import_dir(bufferlist::const_iterator& blp,
   // take all waiters on this dir
   // NOTE: a pass of imported data is guaranteed to get all of my waiters because
   // a replica's presense in my cache implies/forces it's presense in authority's.
-  MDSInternalContextBase::vec waiters;
+  MDSContext::vec waiters;
   dir->take_waiting(CDir::WAIT_ANY_MASK, waiters);
   for (auto c : waiters)
     dir->add_waiter(CDir::WAIT_UNFREEZE, c);  // UNFREEZE will get kicked both on success or failure
index 75038b8f3b0762a15843900910946142dbcf35c0..e237463abccc84dc7f2fbd25e537d0de2469faee 100644 (file)
@@ -329,7 +329,7 @@ public:
                                std::map<client_t,client_metadata_t>& exported_client_metadata_map);
   void finish_export_inode(CInode *in, mds_rank_t target,
                           std::map<client_t,Capability::Import>& peer_imported,
-                          MDSInternalContextBase::vec& finished);
+                          MDSContext::vec& finished);
   void finish_export_inode_caps(CInode *in, mds_rank_t target,
                                std::map<client_t,Capability::Import>& peer_imported);
 
@@ -340,7 +340,7 @@ public:
                        std::map<client_t,client_metadata_t>& exported_client_metadata_map);
   void finish_export_dir(CDir *dir, mds_rank_t target,
                         std::map<inodeno_t,std::map<client_t,Capability::Import> >& peer_imported,
-                        MDSInternalContextBase::vec& finished, int *num_dentries);
+                        MDSContext::vec& finished, int *num_dentries);
 
   void clear_export_proxy_pins(CDir *dir);
 
index 25e29366a002ad6a8853ad10f0a0142c3801cb6b..fa5d3c715ec01ac967ed71e8e742bf71bed61cf7 100644 (file)
@@ -322,7 +322,7 @@ struct MDRequestImpl : public MutationImpl {
     Context *slave_commit = nullptr;
     bufferlist rollback_bl;
 
-    MDSInternalContextBase::vec waiting_for_finish;
+    MDSContext::vec waiting_for_finish;
 
     // export & fragment
     CDir* export_dir = nullptr;
index 703e86c9d1a233d8a37ba267c95971d93fed25fb..323069db931973aa567052fdce5fd626103e1da2 100644 (file)
@@ -208,10 +208,10 @@ class C_IO_OFT_Save : public MDSIOContextBase {
 protected:
   OpenFileTable *oft;
   uint64_t log_seq;
-  MDSInternalContextBase *fin;
+  MDSContext *fin;
   MDSRank *get_mds() override { return oft->mds; }
 public:
-  C_IO_OFT_Save(OpenFileTable *t, uint64_t s, MDSInternalContextBase *c) :
+  C_IO_OFT_Save(OpenFileTable *t, uint64_t s, MDSContext *c) :
     oft(t), log_seq(s), fin(c) {}
   void finish(int r) {
     oft->_commit_finish(r, log_seq, fin);
@@ -221,7 +221,7 @@ public:
   }
 };
 
-void OpenFileTable::_commit_finish(int r, uint64_t log_seq, MDSInternalContextBase *fin)
+void OpenFileTable::_commit_finish(int r, uint64_t log_seq, MDSContext *fin)
 {
   dout(10) << __func__ << " log_seq " << log_seq << dendl;
   if (r < 0) {
@@ -242,11 +242,11 @@ class C_IO_OFT_Journal : public MDSIOContextBase {
 protected:
   OpenFileTable *oft;
   uint64_t log_seq;
-  MDSInternalContextBase *fin;
+  MDSContext *fin;
   std::map<unsigned, std::vector<ObjectOperation> > ops_map;
   MDSRank *get_mds() override { return oft->mds; }
 public:
-  C_IO_OFT_Journal(OpenFileTable *t, uint64_t s, MDSInternalContextBase *c,
+  C_IO_OFT_Journal(OpenFileTable *t, uint64_t s, MDSContext *c,
                   std::map<unsigned, std::vector<ObjectOperation> >& ops) :
     oft(t), log_seq(s), fin(c) {
     ops_map.swap(ops);
@@ -259,7 +259,7 @@ public:
   }
 };
 
-void OpenFileTable::_journal_finish(int r, uint64_t log_seq, MDSInternalContextBase *c,
+void OpenFileTable::_journal_finish(int r, uint64_t log_seq, MDSContext *c,
                                    std::map<unsigned, std::vector<ObjectOperation> >& ops_map)
 {
   dout(10) << __func__ << " log_seq " << log_seq << dendl;
@@ -286,7 +286,7 @@ void OpenFileTable::_journal_finish(int r, uint64_t log_seq, MDSInternalContextB
   return;
 }
 
-void OpenFileTable::commit(MDSInternalContextBase *c, uint64_t log_seq, int op_prio)
+void OpenFileTable::commit(MDSContext *c, uint64_t log_seq, int op_prio)
 {
   dout(10) << __func__ << " log_seq " << log_seq << dendl;
 
@@ -924,7 +924,7 @@ out:
   waiting_for_load.clear();
 }
 
-void OpenFileTable::load(MDSInternalContextBase *onload)
+void OpenFileTable::load(MDSContext *onload)
 {
   dout(10) << __func__ << dendl;
   ceph_assert(!load_done);
@@ -976,7 +976,7 @@ bool OpenFileTable::get_ancestors(inodeno_t ino, vector<inode_backpointer_t>& an
   return true;
 }
 
-class C_OFT_OpenInoFinish: public MDSInternalContextBase {
+class C_OFT_OpenInoFinish: public MDSContext {
   OpenFileTable *oft;
   inodeno_t ino;
   MDSRank *get_mds() override { return oft->mds; }
index 4ffb397475366a42ece30566f765d79ba6d3dc84..cf17a30a0463e3596a462959d2d9bcea3ac841d5 100644 (file)
@@ -37,14 +37,14 @@ public:
   void notify_unlink(CInode *in);
   bool is_any_dirty() const { return !dirty_items.empty(); }
 
-  void commit(MDSInternalContextBase *c, uint64_t log_seq, int op_prio);
+  void commit(MDSContext *c, uint64_t log_seq, int op_prio);
   uint64_t get_committed_log_seq() const { return committed_log_seq; }
   uint64_t get_committing_log_seq() const { return committing_log_seq; }
   bool is_any_committing() const { return num_pending_commit > 0; }
 
-  void load(MDSInternalContextBase *c);
+  void load(MDSContext *c);
   bool is_loaded() const { return load_done; }
-  void wait_for_load(MDSInternalContextBase *c) {
+  void wait_for_load(MDSContext *c) {
     ceph_assert(!load_done);
     waiting_for_load.push_back(c);
   }
@@ -54,7 +54,7 @@ public:
 
   bool prefetch_inodes();
   bool is_prefetched() const { return prefetch_state == DONE; }
-  void wait_for_prefetch(MDSInternalContextBase *c) {
+  void wait_for_prefetch(MDSContext *c) {
     ceph_assert(!is_prefetched());
     waiting_for_prefetch.push_back(c);
   }
@@ -98,14 +98,14 @@ protected:
 
   unsigned num_pending_commit = 0;
   void _encode_header(bufferlist& bl, int j_state);
-  void _commit_finish(int r, uint64_t log_seq, MDSInternalContextBase *fin);
-  void _journal_finish(int r, uint64_t log_seq, MDSInternalContextBase *fin,
+  void _commit_finish(int r, uint64_t log_seq, MDSContext *fin);
+  void _journal_finish(int r, uint64_t log_seq, MDSContext *fin,
                       std::map<unsigned, std::vector<ObjectOperation> >& ops);
 
   std::vector<std::map<std::string, bufferlist> > loaded_journals;
   map<inodeno_t, RecoveredAnchor> loaded_anchor_map;
   set<dirfrag_t> loaded_dirfrags;
-  MDSInternalContextBase::vec waiting_for_load;
+  MDSContext::vec waiting_for_load;
   bool load_done = false;
 
   void _reset_states() {
@@ -130,7 +130,7 @@ protected:
   };
   unsigned prefetch_state = 0;
   unsigned num_opening_inodes = 0;
-  MDSInternalContextBase::vec waiting_for_prefetch;
+  MDSContext::vec waiting_for_prefetch;
   void _open_ino_finish(inodeno_t ino, int r);
   void _prefetch_inodes();
   void _prefetch_dirfrags();
index 1523570dd69a84abc7a37aabcfd96fad86989a28..f2fe7938f4b6872b42ec635fbc12f142debb5471 100644 (file)
@@ -79,7 +79,7 @@ public:
       get_state() == LOCK_MIX;
   }
 
-  void set_xlock_snap_sync(MDSInternalContextBase *c)
+  void set_xlock_snap_sync(MDSContext *c)
   {
     ceph_assert(get_type() == CEPH_LOCK_IFILE);
     ceph_assert(state == LOCK_XLOCK || state == LOCK_XLOCKDONE);
@@ -197,7 +197,7 @@ public:
     encode(s, bl);
   }
 
-  void decode_state_rejoin(bufferlist::const_iterator& p, MDSInternalContextBase::vec& waiters, bool survivor) {
+  void decode_state_rejoin(bufferlist::const_iterator& p, MDSContext::vec& waiters, bool survivor) {
     SimpleLock::decode_state_rejoin(p, waiters, survivor);
     if (is_flushing()) {
       set_dirty();
index 0d72dba8100807855140af444f940adb29ba52e3..c36f932fda4a51f6f917408af962fda5ca1e2299 100644 (file)
@@ -81,7 +81,7 @@ void ScrubStack::pop_inode(CInode *in)
 
 void ScrubStack::_enqueue_inode(CInode *in, CDentry *parent,
                                ScrubHeaderRef& header,
-                               MDSInternalContextBase *on_finish, bool top)
+                               MDSContext *on_finish, bool top)
 {
   dout(10) << __func__ << " with {" << *in << "}"
            << ", on_finish=" << on_finish << ", top=" << top << dendl;
@@ -94,7 +94,7 @@ void ScrubStack::_enqueue_inode(CInode *in, CDentry *parent,
 }
 
 void ScrubStack::enqueue_inode(CInode *in, ScrubHeaderRef& header,
-                               MDSInternalContextBase *on_finish, bool top)
+                               MDSContext *on_finish, bool top)
 {
   // abort in progress
   if (clear_inode_stack) {
@@ -477,7 +477,7 @@ void ScrubStack::_validate_inode_done(CInode *in, int r,
     dout(10) << __func__ << " scrub passed on inode " << *in << dendl;
   }
 
-  MDSInternalContextBase *c = NULL;
+  MDSContext *c = NULL;
   in->scrub_finished(&c);
 
   if (in == header->get_origin()) {
@@ -611,7 +611,7 @@ void ScrubStack::abort_pending_scrubs() {
       scrub_origins.erase(in);
     }
 
-    MDSInternalContextBase *ctx = nullptr;
+    MDSContext *ctx = nullptr;
     in->scrub_aborted(&ctx);
     if (ctx != nullptr) {
       ctx->complete(-ECANCELED);
index e01cebfa484e8580b017bf813c13aa8ce0860e6a..de51ed3fd94e4b678128e1dea210dd56276c729e 100644 (file)
@@ -78,7 +78,7 @@ public:
    *               was initiated
    */
   void enqueue_inode_top(CInode *in, ScrubHeaderRef& header,
-                        MDSInternalContextBase *on_finish) {
+                        MDSContext *on_finish) {
     enqueue_inode(in, header, on_finish, true);
     scrub_origins.emplace(in);
   }
@@ -86,7 +86,7 @@ public:
    * starting this one.
    */
   void enqueue_inode_bottom(CInode *in, ScrubHeaderRef& header,
-                           MDSInternalContextBase *on_finish) {
+                           MDSContext *on_finish) {
     enqueue_inode(in, header, on_finish, false);
     scrub_origins.emplace(in);
   }
@@ -153,9 +153,9 @@ private:
    * the given scrub params, and then try and kick off more scrubbing.
    */
   void enqueue_inode(CInode *in, ScrubHeaderRef& header,
-                      MDSInternalContextBase *on_finish, bool top);
+                      MDSContext *on_finish, bool top);
   void _enqueue_inode(CInode *in, CDentry *parent, ScrubHeaderRef& header,
-                      MDSInternalContextBase *on_finish, bool top);
+                      MDSContext *on_finish, bool top);
   /**
    * Kick off as many scrubs as are appropriate, based on the current
    * state of the stack.
index 455a6d0ef4872ca44b222e0eaab346e5ec4452ed..ee801a718eaf7613be60b07dde45358638b6ace7 100644 (file)
@@ -63,7 +63,7 @@
 #undef dout_prefix
 #define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".server "
 
-class ServerContext : public MDSInternalContextBase {
+class ServerContext : public MDSContext {
   protected:
   Server *server;
   MDSRank *get_mds() override
@@ -688,7 +688,7 @@ void Server::flush_client_sessions(set<client_t>& client_set, MDSGatherBuilder&
 
 void Server::finish_flush_session(Session *session, version_t seq)
 {
-  MDSInternalContextBase::vec finished;
+  MDSContext::vec finished;
   session->finish_flush(seq, finished);
   mds->queue_waiters(finished);
 }
@@ -1081,7 +1081,7 @@ void Server::handle_conf_change(const ConfigProxy& conf,
 }
 
 /*
- * XXX bump in the interface here, not using an MDSInternalContextBase here
+ * XXX bump in the interface here, not using an MDSContext here
  * because all the callers right now happen to use a SaferCond
  */
 void Server::kill_session(Session *session, Context *on_safe)
@@ -1169,7 +1169,7 @@ void Server::journal_close_session(Session *session, int state, Context *on_safe
   finish_flush_session(session, session->get_push_seq());
 }
 
-void Server::reconnect_clients(MDSInternalContext *reconnect_done_)
+void Server::reconnect_clients(MDSContext *reconnect_done_)
 {
   reconnect_done = reconnect_done_;
 
@@ -3196,7 +3196,7 @@ public:
 class CF_MDS_MDRContextFactory : public MDSContextFactory {
 public:
   CF_MDS_MDRContextFactory(MDCache *cache, MDRequestRef &mdr) : cache(cache), mdr(mdr) {}
-  MDSInternalContextBase *build() {
+  MDSContext *build() {
     return new C_MDS_RetryRequest(cache, mdr);
   }
 private:
@@ -3270,7 +3270,7 @@ CInode* Server::rdlock_path_pin_ref(MDRequestRef& mdr, int n,
       respond_to_request(mdr, r);
     } else if (r == -ESTALE) {
       dout(10) << "FAIL on ESTALE but attempting recovery" << dendl;
-      MDSInternalContextBase *c = new C_MDS_TryFindInode(this, mdr);
+      MDSContext *c = new C_MDS_TryFindInode(this, mdr);
       mdcache->find_ino_peers(refpath.get_ino(), c);
     } else {
       dout(10) << "FAIL on error " << r << dendl;
@@ -4014,7 +4014,7 @@ void Server::handle_client_openc(MDRequestRef& mdr)
     if (r < 0 && r != -ENOENT) {
       if (r == -ESTALE) {
        dout(10) << "FAIL on ESTALE but attempting recovery" << dendl;
-       MDSInternalContextBase *c = new C_MDS_TryFindInode(this, mdr);
+       MDSContext *c = new C_MDS_TryFindInode(this, mdr);
        mdcache->find_ino_peers(req->get_filepath().get_ino(), c);
       } else {
        dout(10) << "FAIL on error " << r << dendl;
@@ -4521,7 +4521,7 @@ void Server::handle_client_file_setlock(MDRequestRef& mdr)
   dout(10) << " state prior to lock change: " << *lock_state << dendl;
   if (CEPH_LOCK_UNLOCK == set_lock.type) {
     list<ceph_filelock> activated_locks;
-    MDSInternalContextBase::vec waiters;
+    MDSContext::vec waiters;
     if (lock_state->is_waiting(set_lock)) {
       dout(10) << " unlock removing waiting lock " << set_lock << dendl;
       lock_state->remove_waiting(set_lock);
@@ -8798,7 +8798,7 @@ void Server::_commit_slave_rename(MDRequestRef& mdr, int r,
   if (srcdn->is_auth() && srcdn->get_dir()->inode->is_stray())
     migrated_stray = in->ino();
 
-  MDSInternalContextBase::vec finished;
+  MDSContext::vec finished;
   if (r == 0) {
     // unfreeze+singleauth inode
     //  hmm, do i really need to delay this?
@@ -9311,7 +9311,7 @@ void Server::_rename_rollback_finish(MutationRef& mut, MDRequestRef& mdr, CDentr
   }
 
   if (mdr) {
-    MDSInternalContextBase::vec finished;
+    MDSContext::vec finished;
     if (mdr->more()->is_ambiguous_auth) {
       if (srcdn->is_auth())
        mdr->more()->rename_inode->unfreeze_inode(finished);
index 6bb84b061513968b33ec6dd66cd6e62e21f23a0f..e46cf2cad4eb3b5eb5a13dd3d69d83212224aea1 100644 (file)
@@ -94,7 +94,7 @@ private:
   bool is_full;
 
   // State for while in reconnect
-  MDSInternalContext *reconnect_done;
+  MDSContext *reconnect_done;
   int failed_reconnects;
   bool reconnect_evicting;  // true if I am waiting for evictions to complete
                             // before proceeding to reconnect_gather_finish
@@ -159,7 +159,7 @@ public:
   void finish_reclaim_session(Session *session, const MClientReclaimReply::ref &reply=nullptr);
   void handle_client_reclaim(const MClientReclaim::const_ref &m);
 
-  void reconnect_clients(MDSInternalContext *reconnect_done_);
+  void reconnect_clients(MDSContext *reconnect_done_);
   void handle_client_reconnect(const MClientReconnect::const_ref &m);
   void infer_supported_features(Session *session, client_metadata_t& client_metadata);
   void update_required_client_features();
index 340ad0fa541437ee524c3a974928ed32711c9147..c3d752af995df113f21a644dcfb06f40fa445d7d 100644 (file)
@@ -270,7 +270,7 @@ void SessionMap::_load_finish(
  * Populate session state from OMAP records in this
  * rank's sessionmap object.
  */
-void SessionMap::load(MDSInternalContextBase *onload)
+void SessionMap::load(MDSContext *onload)
 {
   dout(10) << "load" << dendl;
 
@@ -373,7 +373,7 @@ public:
 };
 }
 
-void SessionMap::save(MDSInternalContextBase *onsave, version_t needv)
+void SessionMap::save(MDSContext *onsave, version_t needv)
 {
   dout(10) << __func__ << ": needv " << needv << ", v " << version << dendl;
  
@@ -722,9 +722,9 @@ version_t SessionMap::mark_projected(Session *s)
 
 namespace {
 class C_IO_SM_Save_One : public SessionMapIOContext {
-  MDSInternalContextBase *on_safe;
+  MDSContext *on_safe;
 public:
-  C_IO_SM_Save_One(SessionMap *cm, MDSInternalContextBase *on_safe_)
+  C_IO_SM_Save_One(SessionMap *cm, MDSContext *on_safe_)
     : SessionMapIOContext(cm), on_safe(on_safe_) {}
   void finish(int r) override {
     if (r != 0) {
@@ -810,7 +810,7 @@ void SessionMap::save_if_dirty(const std::set<entity_name_t> &tgt_sessions,
       SnapContext snapc;
       object_t oid = get_object_name();
       object_locator_t oloc(mds->mdsmap->get_metadata_pool());
-      MDSInternalContextBase *on_safe = gather_bld->new_sub();
+      MDSContext *on_safe = gather_bld->new_sub();
       mds->objecter->mutate(oid, oloc, op, snapc,
                            ceph::real_clock::now(), 0,
                            new C_OnFinisher(
index b7f747684136c9678c97574160dd7b57f6b02ce8..dfd5f978ec831f5163ae2f3e06d00c3fde4a03a8 100644 (file)
@@ -263,7 +263,7 @@ public:
 private:
   uint32_t cap_gen = 0;
   version_t cap_push_seq = 0;        // cap push seq #
-  map<version_t, MDSInternalContextBase::vec > waitfor_flush; // flush session messages
+  map<version_t, MDSContext::vec > waitfor_flush; // flush session messages
 
 public:
   xlist<Capability*> caps;     // inodes with caps; front=most recently used
@@ -277,11 +277,11 @@ public:
   version_t inc_push_seq() { return ++cap_push_seq; }
   version_t get_push_seq() const { return cap_push_seq; }
 
-  version_t wait_for_flush(MDSInternalContextBase* c) {
+  version_t wait_for_flush(MDSContext* c) {
     waitfor_flush[get_push_seq()].push_back(c);
     return get_push_seq();
   }
-  void finish_flush(version_t seq, MDSInternalContextBase::vec& ls) {
+  void finish_flush(version_t seq, MDSContext::vec& ls) {
     while (!waitfor_flush.empty()) {
       auto it = waitfor_flush.begin();
       if (it->first > seq)
@@ -536,7 +536,7 @@ protected:
 public:
   map<int,xlist<Session*>* > by_state;
   uint64_t set_state(Session *session, int state);
-  map<version_t, MDSInternalContextBase::vec > commit_waiters;
+  map<version_t, MDSContext::vec > commit_waiters;
   void update_average_session_age();
 
   SessionMap() = delete;
@@ -688,11 +688,11 @@ public:
 
   // -- loading, saving --
   inodeno_t ino;
-  MDSInternalContextBase::vec waiting_for_load;
+  MDSContext::vec waiting_for_load;
 
   object_t get_object_name() const;
 
-  void load(MDSInternalContextBase *onload);
+  void load(MDSContext *onload);
   void _load_finish(
       int operation_r,
       int header_r,
@@ -705,7 +705,7 @@ public:
   void load_legacy();
   void _load_legacy_finish(int r, bufferlist &bl);
 
-  void save(MDSInternalContextBase *onsave, version_t needv=0);
+  void save(MDSContext *onsave, version_t needv=0);
   void _save_finish(version_t v);
 
 protected:
index 4db35a45802c935f52c002a6525cf1606d1789da..a14f37c859fe58ff61be30d33d11f840466549dc 100644 (file)
@@ -323,10 +323,10 @@ public:
   void finish_waiters(uint64_t mask, int r=0) {
     parent->finish_waiting(mask << get_wait_shift(), r);
   }
-  void take_waiting(uint64_t mask, MDSInternalContextBase::vec& ls) {
+  void take_waiting(uint64_t mask, MDSContext::vec& ls) {
     parent->take_waiting(mask << get_wait_shift(), ls);
   }
-  void add_waiter(uint64_t mask, MDSInternalContextBase *c) {
+  void add_waiter(uint64_t mask, MDSContext *c) {
     parent->add_waiter((mask << get_wait_shift()) | MDSCacheObject::WAIT_ORDERED, c);
   }
   bool is_waiter_for(uint64_t mask) const {
@@ -342,7 +342,7 @@ public:
     //assert(!is_stable() || gather_set.size() == 0);  // gather should be empty in stable states.
     return s;
   }
-  void set_state_rejoin(int s, MDSInternalContextBase::vec& waiters, bool survivor) {
+  void set_state_rejoin(int s, MDSContext::vec& waiters, bool survivor) {
     ceph_assert(!get_parent()->is_auth());
 
     // If lock in the replica object was not in SYNC state when auth mds of the object failed.
@@ -607,7 +607,7 @@ public:
     if (is_new)
       state = s;
   }
-  void decode_state_rejoin(bufferlist::const_iterator& p, MDSInternalContextBase::vec& waiters, bool survivor) {
+  void decode_state_rejoin(bufferlist::const_iterator& p, MDSContext::vec& waiters, bool survivor) {
     __s16 s;
     using ceph::decode;
     decode(s, p);
index 88237424c87cf9a216ef8a9a7bbd27e622ff2dd3..fa1f56b4c35eeb03f021aa06f1f3b1e43b5d41fd 100644 (file)
@@ -97,7 +97,7 @@ void SnapClient::handle_query_result(const MMDSTableRequest::const_ref &m)
     synced = true;
 
   if (synced && !waiting_for_version.empty()) {
-    MDSInternalContextBase::vec finished;
+    MDSContext::vec finished;
     while (!waiting_for_version.empty()) {
       auto it = waiting_for_version.begin();
       if (it->first > cached_version)
@@ -141,7 +141,7 @@ void SnapClient::notify_commit(version_t tid)
   }
 }
 
-void SnapClient::refresh(version_t want, MDSInternalContextBase *onfinish)
+void SnapClient::refresh(version_t want, MDSContext *onfinish)
 {
   dout(10) << __func__ << " want " << want << dendl;
 
@@ -161,7 +161,7 @@ void SnapClient::refresh(version_t want, MDSInternalContextBase *onfinish)
   mds->send_message_mds(req, ts);
 }
 
-void SnapClient::sync(MDSInternalContextBase *onfinish)
+void SnapClient::sync(MDSContext *onfinish)
 {
   dout(10) << __func__ << dendl;
 
index 1a12d671eed29f459d26edf41eeb35837aaf5d91..c0d595ba9a24b568d621a7226f31ff0386c0a358 100644 (file)
@@ -33,7 +33,7 @@ class SnapClient : public MDSTableClient {
 
   set<version_t> committing_tids;
 
-  map<version_t, MDSInternalContextBase::vec > waiting_for_version;
+  map<version_t, MDSContext::vec > waiting_for_version;
 
   uint64_t sync_reqid;
   bool synced;
@@ -50,7 +50,7 @@ public:
   void notify_commit(version_t tid) override;
 
   void prepare_create(inodeno_t dirino, std::string_view name, utime_t stamp,
-                     version_t *pstid, bufferlist *pbl, MDSInternalContextBase *onfinish) {
+                     version_t *pstid, bufferlist *pbl, MDSContext *onfinish) {
     bufferlist bl;
     __u32 op = TABLE_OP_CREATE;
     encode(op, bl);
@@ -60,7 +60,7 @@ public:
     _prepare(bl, pstid, pbl, onfinish);
   }
 
-  void prepare_create_realm(inodeno_t ino, version_t *pstid, bufferlist *pbl, MDSInternalContextBase *onfinish) {
+  void prepare_create_realm(inodeno_t ino, version_t *pstid, bufferlist *pbl, MDSContext *onfinish) {
     bufferlist bl;
     __u32 op = TABLE_OP_CREATE;
     encode(op, bl);
@@ -68,7 +68,7 @@ public:
     _prepare(bl, pstid, pbl, onfinish);
   }
 
-  void prepare_destroy(inodeno_t ino, snapid_t snapid, version_t *pstid, bufferlist *pbl, MDSInternalContextBase *onfinish) {
+  void prepare_destroy(inodeno_t ino, snapid_t snapid, version_t *pstid, bufferlist *pbl, MDSContext *onfinish) {
     bufferlist bl;
     __u32 op = TABLE_OP_DESTROY;
     encode(op, bl);
@@ -78,7 +78,7 @@ public:
   }
 
   void prepare_update(inodeno_t ino, snapid_t snapid, std::string_view name, utime_t stamp,
-                     version_t *pstid, MDSInternalContextBase *onfinish) {
+                     version_t *pstid, MDSContext *onfinish) {
     bufferlist bl;
     __u32 op = TABLE_OP_UPDATE;
     encode(op, bl);
@@ -90,12 +90,12 @@ public:
   }
 
   version_t get_cached_version() const { return cached_version; }
-  void refresh(version_t want, MDSInternalContextBase *onfinish);
+  void refresh(version_t want, MDSContext *onfinish);
 
-  void sync(MDSInternalContextBase *onfinish);
+  void sync(MDSContext *onfinish);
 
   bool is_synced() const { return synced; }
-  void wait_for_sync(MDSInternalContextBase *c) {
+  void wait_for_sync(MDSContext *c) {
     ceph_assert(!synced);
     waiting_for_version[std::max<version_t>(cached_version, 1)].push_back(c);
   }
index 507d206f5819ddb6e1218225fa30f0d006d0640a..242d8fc7bb091947b05432d7c09ee755815b36b4 100644 (file)
@@ -102,13 +102,13 @@ void SnapRealm::remove_open_past_parent(inodeno_t ino, snapid_t last)
   }
 }
 
-struct C_SR_RetryOpenParents : public MDSInternalContextBase {
+struct C_SR_RetryOpenParents : public MDSContext {
   SnapRealm *sr;
   snapid_t first, last, parent_last;
   inodeno_t parent;
-  MDSInternalContextBase* fin;
+  MDSContext* fin;
   C_SR_RetryOpenParents(SnapRealm *s, snapid_t f, snapid_t l, snapid_t pl,
-                       inodeno_t p, MDSInternalContextBase *c) :
+                       inodeno_t p, MDSContext *c) :
     sr(s), first(f), last(l), parent_last(pl),  parent(p), fin(c) {
     sr->inode->get(CInode::PIN_OPENINGSNAPPARENTS);
   }
@@ -137,7 +137,7 @@ void SnapRealm::_remove_missing_parent(snapid_t snapid, inodeno_t parent, int er
   }
 }
 
-bool SnapRealm::_open_parents(MDSInternalContextBase *finish, snapid_t first, snapid_t last)
+bool SnapRealm::_open_parents(MDSContext *finish, snapid_t first, snapid_t last)
 {
   dout(10) << "open_parents [" << first << "," << last << "]" << dendl;
   if (open) 
@@ -198,7 +198,7 @@ bool SnapRealm::_open_parents(MDSInternalContextBase *finish, snapid_t first, sn
   return true;
 }
 
-bool SnapRealm::open_parents(MDSInternalContextBase *retryorfinish) {
+bool SnapRealm::open_parents(MDSContext *retryorfinish) {
   if (!_open_parents(retryorfinish))
     return false;
   delete retryorfinish;
index e16125a3904574d151392d6a35dd93fe7b4c372b..62d6cba952a401bd7870c020e1f2c1affe10e1f0 100644 (file)
@@ -69,8 +69,8 @@ public:
     return false;
   }
 
-  bool _open_parents(MDSInternalContextBase *retryorfinish, snapid_t first=1, snapid_t last=CEPH_NOSNAP);
-  bool open_parents(MDSInternalContextBase *retryorfinish);
+  bool _open_parents(MDSContext *retryorfinish, snapid_t first=1, snapid_t last=CEPH_NOSNAP);
+  bool open_parents(MDSContext *retryorfinish);
   void _remove_missing_parent(snapid_t snapid, inodeno_t parent, int err);
   bool have_past_parents_open(snapid_t first=1, snapid_t last=CEPH_NOSNAP) const;
   void add_open_past_parent(SnapRealm *parent, snapid_t last);
index 99d60d32a913a0f993f0a3f96022bd09718aa8f0..786ca51ab507fb33a2489e859e30dcd142441e7a 100644 (file)
@@ -55,7 +55,7 @@ public:
   explicit StrayManagerLogContext(StrayManager *sm_) : sm(sm_) {}
 };
 
-class StrayManagerContext : public virtual MDSInternalContextBase {
+class StrayManagerContext : public virtual MDSContext {
 protected:
   StrayManager *sm;
   MDSRank *get_mds() override
index 7f1d0e7cd6fc238e808a76e48294293f17542521..4a9a51ebd4707d3b0bd27a4721149e74f90fb096 100644 (file)
@@ -2671,7 +2671,7 @@ void EFragment::replay(MDSRank *mds)
   dout(10) << "EFragment.replay " << op_name(op) << " " << ino << " " << basefrag << " by " << bits << dendl;
 
   list<CDir*> resultfrags;
-  MDSInternalContextBase::vec waiters;
+  MDSContext::vec waiters;
 
   // in may be NULL if it wasn't in our cache yet.  if it's a prepare
   // it will be once we replay the metablob , but first we need to