]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
include/Context.h: de-globalize
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Fri, 10 Jun 2011 20:06:09 +0000 (13:06 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 20 Jun 2011 23:22:25 +0000 (16:22 -0700)
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
23 files changed:
src/client/SyntheticClient.cc
src/include/Context.h
src/mds/CDir.cc
src/mds/CInode.cc
src/mds/Locker.cc
src/mds/MDCache.cc
src/mds/MDLog.cc
src/mds/MDS.cc
src/mds/MDSTable.cc
src/mds/Migrator.cc
src/mds/Server.cc
src/mds/SessionMap.cc
src/mds/journal.cc
src/mds/mdstypes.h
src/mon/Paxos.cc
src/os/FileStore.cc
src/osd/OSD.cc
src/osd/ReplicatedPG.cc
src/osdc/Filer.h
src/osdc/Journaler.cc
src/osdc/ObjectCacher.cc
src/osdc/Objecter.h
src/test/gather.cc

index 98e2fc7b47be16a3510bd104413f00ce8b29f150..540b226c990951b559becaad8fe2c79802e15681 100644 (file)
@@ -1040,7 +1040,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
   Cond cond;
   bool ack;
   bool safe;
-  C_Gather *safeg = new C_Gather(new C_SafeCond(&lock, &cond, &safe));
+  C_Gather *safeg = new C_Gather(&g_ceph_context, new C_SafeCond(&lock, &cond, &safe));
   Context *safegref = safeg->new_sub();  // take a ref
 
   while (!t.end()) {
index f4c795ab540d805b52000dd6298a5a88cfc6432a..46e09bad81f827af069e7114fe760d23d386fb73 100644 (file)
@@ -39,7 +39,7 @@ class Context {
 /*
  * finish and destroy a list of Contexts
  */
-inline void finish_contexts(std::list<Context*>& finished, 
+inline void finish_contexts(CephContext *cct, std::list<Context*>& finished, 
                             int result = 0)
 {
   if (finished.empty())
@@ -48,18 +48,18 @@ inline void finish_contexts(std::list<Context*>& finished,
   list<Context*> ls;
   ls.swap(finished); // swap out of place to avoid weird loops
 
-  dout(10) << ls.size() << " contexts to finish with " << result << dendl;
+  ldout(cct,10) << ls.size() << " contexts to finish with " << result << dendl;
   for (std::list<Context*>::iterator it = ls.begin(); 
        it != ls.end(); 
        it++) {
     Context *c = *it;
-    dout(10) << "---- " << c << dendl;
+    ldout(cct,10) << "---- " << c << dendl;
     c->finish(result);
     delete c;
   }
 }
 
-inline void finish_contexts(std::vector<Context*>& finished, 
+inline void finish_contexts(CephContext *cct, std::vector<Context*>& finished, 
                             int result = 0)
 {
   if (finished.empty())
@@ -68,12 +68,12 @@ inline void finish_contexts(std::vector<Context*>& finished,
   vector<Context*> ls;
   ls.swap(finished); // swap out of place to avoid weird loops
 
-  dout(10) << ls.size() << " contexts to finish with " << result << dendl;
+  ldout(cct,10) << ls.size() << " contexts to finish with " << result << dendl;
   for (std::vector<Context*>::iterator it = ls.begin(); 
        it != ls.end(); 
        it++) {
     Context *c = *it;
-    dout(10) << "---- " << c << dendl;
+    ldout(cct,10) << "---- " << c << dendl;
     c->finish(result);
     delete c;
   }
@@ -90,8 +90,14 @@ public:
  */
 class C_Contexts : public Context {
 public:
+  CephContext *cct;
   std::list<Context*> contexts;
 
+  C_Contexts(CephContext *cct_)
+    : cct(cct_)
+  {
+  }
+
   void add(Context* c) {
     contexts.push_back(c);
   }
@@ -99,7 +105,7 @@ public:
     contexts.splice(contexts.end(), ls);
   }
   void finish(int r) {
-    finish_contexts(contexts, r);
+    finish_contexts(cct, contexts, r);
   }
 };
 
@@ -113,6 +119,7 @@ public:
  */
 class C_Gather : public Context {
 private:
+  CephContext *cct;
   int result;
   Context *onfinish;
 #ifdef DEBUG_GATHER
@@ -132,7 +139,7 @@ private:
 #endif
     --sub_existing_count;
 
-    dout(10) << "C_Gather " << this << ".sub_finish(r=" << r << ") " << sub
+    ldout(cct,10) << "C_Gather " << this << ".sub_finish(r=" << r << ") " << sub
 #ifdef DEBUG_GATHER
                    << " (remaining " << waitfor << ")"
 #endif
@@ -182,15 +189,16 @@ private:
   };
 
 public:
-  C_Gather(Context *f=0, bool an=false) : result(0), onfinish(f), sub_created_count(0),
-                                          sub_existing_count(0),
-                                          lock("C_Gather::lock", true, false), //disable lockdep
-                                          any(an),
-                                         activated(onfinish ? true : false) {
-    dout(10) << "C_Gather " << this << ".new" << dendl;
+  C_Gather(CephContext *cct_, Context *f=0, bool an=false) 
+    : cct(cct_), result(0), onfinish(f), sub_created_count(0),
+      sub_existing_count(0),
+      lock("C_Gather::lock", true, false), //disable lockdep
+      any(an), activated(onfinish ? true : false)
+  {
+    ldout(cct,10) << "C_Gather " << this << ".new" << dendl;
   }
   ~C_Gather() {
-    dout(10) << "C_Gather " << this << ".delete" << dendl;
+    ldout(cct,10) << "C_Gather " << this << ".delete" << dendl;
     assert(sub_existing_count == 0);
 #ifdef DEBUG_GATHER
     assert(waitfor.empty());
@@ -212,7 +220,7 @@ public:
 #ifdef DEBUG_GATHER
     waitfor.insert(s);
 #endif
-    dout(10) << "C_Gather " << this << ".new_sub is " << sub_created_count << " " << s << dendl;
+    ldout(cct,10) << "C_Gather " << this << ".new_sub is " << sub_created_count << " " << s << dendl;
     return s;
   }
   void rm_sub(Context *s) {
index bfb6cf3944f032aad9fbfda360a9b5a414f61a78..f40e70ed05caeb85bbda9981b679b6e32ff55bc2 100644 (file)
@@ -1169,7 +1169,7 @@ void CDir::finish_waiting(uint64_t mask, int result)
   list<Context*> finished;
   take_waiting(mask, finished);
   if (result < 0)
-    finish_contexts(finished, result);
+    finish_contexts(&g_ceph_context, finished, result);
   else
     cache->mds->queue_waiters(finished);
 }
@@ -1956,7 +1956,7 @@ void CDir::_commit(version_t want)
                                  new C_Dir_Committed(this, get_version(),
                                        inode->inode.last_renamed_version));
   else { // send in a different Context
-    C_Gather *gather = new C_Gather(new C_Dir_Committed(this, get_version(),
+    C_Gather *gather = new C_Gather(&g_ceph_context, new C_Dir_Committed(this, get_version(),
                                          inode->inode.last_renamed_version));
     while (committed_dn != items.end()) {
       ObjectOperation n = ObjectOperation();
index ca2b52e36caaebc8885b00360f6d019ca9925a6b..5276929266eacf36c951e12e9657698865cbf9d6 100644 (file)
@@ -995,7 +995,7 @@ void CInode::fetch(Context *fin)
   dout(10) << "fetch" << dendl;
 
   C_Inode_Fetched *c = new C_Inode_Fetched(this, fin);
-  C_Gather *gather = new C_Gather(c);
+  C_Gather *gather = new C_Gather(&g_ceph_context, c);
 
   object_t oid = CInode::get_object_name(ino(), frag_t(), "");
   object_locator_t oloc(mdcache->mds->mdsmap->get_metadata_pg_pool());
index b6cce0a4a9fc2dcc0477ceafe036e8788cf2d7c2..f496ef0cbf93b1043eb3176b6cdce85ad72d6e38 100644 (file)
@@ -799,7 +799,7 @@ void Locker::eval_cap_gather(CInode *in, set<CInode*> *issue_set)
       issue_caps(in);
   }
 
-  finish_contexts(finishers);
+  finish_contexts(&g_ceph_context, finishers);
 }
 
 void Locker::eval_scatter_gathers(CInode *in)
@@ -820,7 +820,7 @@ void Locker::eval_scatter_gathers(CInode *in)
   if (need_issue && in->is_head())
     issue_caps(in);
   
-  finish_contexts(finishers);
+  finish_contexts(&g_ceph_context, finishers);
 }
 
 void Locker::eval(SimpleLock *lock, bool *need_issue)
index 7e301bea8ea49be81aa9bd2572b43a0faa2cb7cd..e8ba93389627ed7504db73941bb8301c0ba07fec 100644 (file)
@@ -3607,7 +3607,7 @@ C_Gather *MDCache::parallel_fetch(map<inodeno_t,filepath>& pathmap, set<inodeno_
 {
   dout(10) << "parallel_fetch on " << pathmap.size() << " paths" << dendl;
 
-  C_Gather *gather = new C_Gather;
+  C_Gather *gather = new C_Gather(&g_ceph_context);
 
   // scan list
   set<CDir*> fetch_queue;
@@ -4603,7 +4603,7 @@ void MDCache::open_snap_parents()
   dout(10) << "open_snap_parents" << dendl;
   
   map<client_t,MClientSnap*> splits;
-  C_Gather *gather = new C_Gather;
+  C_Gather *gather = new C_Gather(&g_ceph_context);
 
   map<CInode*,map<client_t,set<inodeno_t> > >::iterator p = missing_snap_parents.begin();
   while (p != missing_snap_parents.end()) {
@@ -4673,7 +4673,7 @@ void MDCache::open_undef_dirfrags()
        p++) {
     CDir *dir = *p;
     if (!gather)
-      gather = new C_Gather(new C_MDC_OpenUndefDirfragsFinish(this));
+      gather = new C_Gather(&g_ceph_context, new C_MDC_OpenUndefDirfragsFinish(this));
     dir->fetch(gather->new_sub());
   }
 
@@ -8785,7 +8785,7 @@ void MDCache::handle_discover_reply(MDiscoverReply *m)
   }
 
   // waiters
-  finish_contexts(error, -ENOENT);  // finish errors directly
+  finish_contexts(&g_ceph_context, error, -ENOENT);  // finish errors directly
   mds->queue_waiters(finished);
 
   // done
@@ -9436,7 +9436,7 @@ void MDCache::split_dir(CDir *dir, int bits)
     return;
   }
 
-  C_Gather *gather = new C_Gather(new C_MDC_FragmentFrozen(this, dirs, dir->get_frag(), bits));
+  C_Gather *gather = new C_Gather(&g_ceph_context, new C_MDC_FragmentFrozen(this, dirs, dir->get_frag(), bits));
   fragment_freeze_dirs(dirs, gather);
 
   // initial mark+complete pass
@@ -9470,7 +9470,7 @@ void MDCache::merge_dir(CInode *diri, frag_t frag)
   int bits = first->get_frag().bits() - frag.bits();
   dout(10) << " we are merginb by " << bits << " bits" << dendl;
 
-  C_Gather *gather = new C_Gather(new C_MDC_FragmentFrozen(this, dirs, frag, bits));
+  C_Gather *gather = new C_Gather(&g_ceph_context, new C_MDC_FragmentFrozen(this, dirs, frag, bits));
   fragment_freeze_dirs(dirs, gather);
 
   // initial mark+complete pass
@@ -9514,7 +9514,8 @@ void MDCache::fragment_mark_and_complete(list<CDir*>& dirs)
     if (!dir->is_complete()) {
       dout(15) << " fetching incomplete " << *dir << dendl;
       if (!gather)
-       gather = new C_Gather(new C_MDC_FragmentMarking(this, dirs));
+       gather = new C_Gather(&g_ceph_context,
+                   new C_MDC_FragmentMarking(this, dirs));
       dir->fetch(gather->new_sub(), 
                 true);  // ignore authpinnability
     } 
@@ -9640,7 +9641,9 @@ void MDCache::fragment_frozen(list<CDir*>& dirs, frag_t basefrag, int bits)
   */
 
   // freeze, journal, and store resulting frags
-  C_Gather *gather = new C_Gather(new C_MDC_FragmentLoggedAndStored(this, mut, resultfrags, basefrag, bits));
+  C_Gather *gather = new C_Gather(&g_ceph_context, 
+                     new C_MDC_FragmentLoggedAndStored(this, mut, 
+                                 resultfrags, basefrag, bits));
 
   for (list<CDir*>::iterator p = resultfrags.begin();
        p != resultfrags.end();
index 400dc097a701371c054f752081fd5546c5f4128c..e588cf97d2b40d957085b071f8376c0d07c0309d 100644 (file)
@@ -573,7 +573,7 @@ void MDLog::_replay_thread()
   }
 
   dout(10) << "_replay_thread kicking waiters" << dendl;
-  finish_contexts(waitfor_replay, 0);  
+  finish_contexts(&g_ceph_context, waitfor_replay, 0);  
 
   dout(10) << "_replay_thread finish" << dendl;
   mds->mds_lock.Unlock();
index 80aab34dcc1ce7f63152eb0f86ac69caafb873aa..0d55aea673b387d291e59d140808f078db3c85d8 100644 (file)
@@ -1112,7 +1112,7 @@ void MDS::boot_create()
 {
   dout(3) << "boot_create" << dendl;
 
-  C_Gather *fin = new C_Gather(new C_MDS_CreateFinish(this));
+  C_Gather *fin = new C_Gather(&g_ceph_context, new C_MDS_CreateFinish(this));
 
   mdcache->init_layouts();
 
@@ -1188,7 +1188,7 @@ void MDS::boot_start(int step, int r)
 
   case 1:
     {
-      C_Gather *gather = new C_Gather(new C_MDS_BootStart(this, 2));
+      C_Gather *gather = new C_Gather(&g_ceph_context, new C_MDS_BootStart(this, 2));
       dout(2) << "boot_start " << step << ": opening inotable" << dendl;
       inotable->load(gather->new_sub());
 
@@ -1212,7 +1212,7 @@ void MDS::boot_start(int step, int r)
     {
       dout(2) << "boot_start " << step << ": loading/discovering base inodes" << dendl;
 
-      C_Gather *gather = new C_Gather(new C_MDS_BootStart(this, 3));
+      C_Gather *gather = new C_Gather(&g_ceph_context, new C_MDS_BootStart(this, 3));
 
       mdcache->open_mydir_inode(gather->new_sub());
 
@@ -1429,7 +1429,7 @@ void MDS::reconnect_start()
     reopen_log();
 
   server->reconnect_clients();
-  finish_contexts(waiting_for_reconnect);
+  finish_contexts(&g_ceph_context, waiting_for_reconnect);
 }
 void MDS::reconnect_done()
 {
@@ -1464,7 +1464,7 @@ void MDS::rejoin_done()
 void MDS::clientreplay_start()
 {
   dout(1) << "clientreplay_start" << dendl;
-  finish_contexts(waiting_for_replay);  // kick waiters
+  finish_contexts(&g_ceph_context, waiting_for_replay);  // kick waiters
   queue_one_replay();
 }
 
@@ -1483,8 +1483,8 @@ void MDS::active_start()
 
   mdcache->clean_open_file_lists();
   mdcache->scan_stray_dir();
-  finish_contexts(waiting_for_replay);  // kick waiters
-  finish_contexts(waiting_for_active);  // kick waiters
+  finish_contexts(&g_ceph_context, waiting_for_replay);  // kick waiters
+  finish_contexts(&g_ceph_context, waiting_for_active);  // kick waiters
 }
 
 
index b0ada8459f9def288dbd750196ce2d27a2949fcc..403a8377921303621047bf84f6af3260532f6b37 100644 (file)
@@ -83,7 +83,7 @@ void MDSTable::save_2(version_t v)
     ls.splice(ls.end(), waitfor_save.begin()->second);
     waitfor_save.erase(waitfor_save.begin());
   }
-  finish_contexts(ls,0);
+  finish_contexts(&g_ceph_context, ls,0);
 }
 
 
index 50a25cc7ea73471ea05ee22ca7d148153e71681e..93df2c20779c4034761950a0a78d125c56dde94e 100644 (file)
@@ -1481,7 +1481,7 @@ void Migrator::export_finish(CDir *dir)
   assert(g_conf->mds_kill_export_at != 13);
   
   // finish export (adjust local cache state)
-  C_Contexts *fin = new C_Contexts;
+  C_Contexts *fin = new C_Contexts(&g_ceph_context);
   finish_export_dir(dir, fin->contexts, g_clock.now());
   dir->add_waiter(CDir::WAIT_UNFREEZE, fin);
 
index e0234df4a5f5958eb11f9bf6f1d264a7ef1bdbf1..e8b06d912e5971a68eb416cf0f837cdc0559fd1a 100644 (file)
@@ -4933,7 +4933,7 @@ void Server::handle_client_rename(MDRequest *mdr)
       vector<Anchor> trace;
       destdn->make_anchor_trace(trace, srcdnl->get_inode());
       
-      anchorgather = new C_Gather(new C_MDS_RetryRequest(mdcache, mdr));
+      anchorgather = new C_Gather(&g_ceph_context, new C_MDS_RetryRequest(mdcache, mdr));
       mds->anchorclient->prepare_update(srcdnl->get_inode()->ino(), trace, &mdr->more()->src_reanchor_atid, 
                                        anchorgather->new_sub());
     }
@@ -4947,7 +4947,7 @@ void Server::handle_client_rename(MDRequest *mdr)
       straydn->make_anchor_trace(trace, destdnl->get_inode());
       
       if (!anchorgather)
-       anchorgather = new C_Gather(new C_MDS_RetryRequest(mdcache, mdr));
+       anchorgather = new C_Gather(&g_ceph_context, new C_MDS_RetryRequest(mdcache, mdr));
       mds->anchorclient->prepare_update(destdnl->get_inode()->ino(), trace, &mdr->more()->dst_reanchor_atid, 
                                        anchorgather->new_sub());
     }
index 07dba4773c01be8cf44518fa6842b97ba402bbcd..b6adb41fb06ad3693078502c6e8798edcc77dd12 100644 (file)
@@ -84,7 +84,7 @@ void SessionMap::_load_finish(int r, bufferlist &bl)
           << dendl;
   projected = committing = committed = version;
   dump();
-  finish_contexts(waiting_for_load);
+  finish_contexts(&g_ceph_context, waiting_for_load);
 }
 
 
@@ -132,7 +132,7 @@ void SessionMap::_save_finish(version_t v)
   dout(10) << "_save_finish v" << v << dendl;
   committed = v;
 
-  finish_contexts(commit_waiters[v]);
+  finish_contexts(&g_ceph_context, commit_waiters[v]);
   commit_waiters.erase(v);
 }
 
index b24e1619f89bb0899a4be48d5dc6ef0d2477a2ee..b4b7bb960def1afbc8acd39385aa5625c343c7cc 100644 (file)
@@ -102,14 +102,14 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
     dout(20) << " dirty_inode " << **p << dendl;
     assert((*p)->is_auth());
     if ((*p)->is_base()) {
-      if (!gather) gather = new C_Gather;
+      if (!gather) gather = new C_Gather(&g_ceph_context);
       (*p)->store(gather->new_sub());
     } else
       commit.insert((*p)->get_parent_dn()->get_dir());
   }
 
   if (!commit.empty()) {
-    if (!gather) gather = new C_Gather;
+    if (!gather) gather = new C_Gather(&g_ceph_context);
     
     for (set<CDir*>::iterator p = commit.begin();
         p != commit.end();
@@ -131,7 +131,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
        p != uncommitted_masters.end();
        p++) {
     dout(10) << "try_to_expire waiting for slaves to ack commit on " << *p << dendl;
-    if (!gather) gather = new C_Gather;
+    if (!gather) gather = new C_Gather(&g_ceph_context);
     mds->mdcache->wait_for_uncommitted_master(*p, gather->new_sub());
   }
 
@@ -139,19 +139,19 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
   for (elist<CInode*>::iterator p = dirty_dirfrag_dir.begin(); !p.end(); ++p) {
     CInode *in = *p;
     dout(10) << "try_to_expire waiting for dirlock flush on " << *in << dendl;
-    if (!gather) gather = new C_Gather;
+    if (!gather) gather = new C_Gather(&g_ceph_context);
     mds->locker->scatter_nudge(&in->filelock, gather->new_sub());
   }
   for (elist<CInode*>::iterator p = dirty_dirfrag_dirfragtree.begin(); !p.end(); ++p) {
     CInode *in = *p;
     dout(10) << "try_to_expire waiting for dirfragtreelock flush on " << *in << dendl;
-    if (!gather) gather = new C_Gather;
+    if (!gather) gather = new C_Gather(&g_ceph_context);
     mds->locker->scatter_nudge(&in->dirfragtreelock, gather->new_sub());
   }
   for (elist<CInode*>::iterator p = dirty_dirfrag_nest.begin(); !p.end(); ++p) {
     CInode *in = *p;
     dout(10) << "try_to_expire waiting for nest flush on " << *in << dendl;
-    if (!gather) gather = new C_Gather;
+    if (!gather) gather = new C_Gather(&g_ceph_context);
     mds->locker->scatter_nudge(&in->nestlock, gather->new_sub());
   }
 
@@ -195,7 +195,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
       }
     }
     if (le) {
-      if (!gather) gather = new C_Gather;
+      if (!gather) gather = new C_Gather(&g_ceph_context);
       mds->mdlog->submit_entry(le, gather->new_sub());
       dout(10) << "try_to_expire waiting for open files to rejournal" << dendl;
     }
@@ -206,7 +206,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
     CInode *in = *p;
     dout(10) << "try_to_expire waiting for dir parent pointer update on " << *in << dendl;
     assert(in->state_test(CInode::STATE_DIRTYPARENT));
-    if (!gather) gather = new C_Gather;
+    if (!gather) gather = new C_Gather(&g_ceph_context);
     in->store_parent(gather->new_sub());
   }
 
@@ -217,7 +217,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
     MDSlaveUpdate *su = *p;
     dout(10) << "try_to_expire waiting on slave update " << su << dendl;
     assert(su->waiter == 0);
-    if (!gather) gather = new C_Gather;
+    if (!gather) gather = new C_Gather(&g_ceph_context);
     su->waiter = gather->new_sub();
   }
 
@@ -227,7 +227,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
              << ", committed is " << mds->inotable->get_committed_version()
              << " (" << mds->inotable->get_committing_version() << ")"
              << dendl;
-    if (!gather) gather = new C_Gather;
+    if (!gather) gather = new C_Gather(&g_ceph_context);
     mds->inotable->save(gather->new_sub(), inotablev);
   }
 
@@ -237,7 +237,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
              << ", committed is " << mds->sessionmap.committed
              << " (" << mds->sessionmap.committing << ")"
              << dendl;
-    if (!gather) gather = new C_Gather;
+    if (!gather) gather = new C_Gather(&g_ceph_context);
     mds->sessionmap.save(gather->new_sub(), sessionmapv);
   }
 
@@ -249,7 +249,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
     for (hash_set<version_t>::iterator q = p->second.begin();
         q != p->second.end();
         ++q) {
-      if (!gather) gather = new C_Gather;
+      if (!gather) gather = new C_Gather(&g_ceph_context);
       dout(10) << "try_to_expire " << get_mdstable_name(p->first) << " transaction " << *q 
               << " pending commit (not yet acked), waiting" << dendl;
       assert(!client->has_committed(*q));
@@ -265,7 +265,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
     if (p->second > server->get_committed_version()) {
       dout(10) << "try_to_expire waiting for " << get_mdstable_name(p->first) 
               << " to save, need " << p->second << dendl;
-      if (!gather) gather = new C_Gather;
+      if (!gather) gather = new C_Gather(&g_ceph_context);
       server->save(gather->new_sub());
     }
   }
@@ -275,7 +275,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
        p != truncating_inodes.end();
        p++) {
     dout(10) << "try_to_expire waiting for truncate of " << **p << dendl;
-    if (!gather) gather = new C_Gather;
+    if (!gather) gather = new C_Gather(&g_ceph_context);
     (*p)->add_waiter(CInode::WAIT_TRUNC, gather->new_sub());
   }
   
index 2f142d6b64a1fc9ee31a0aac1d1620ea51d77f66..f9c97b6f17ef047e80a6eda8b079818f695f1f55 100644 (file)
@@ -1497,7 +1497,7 @@ protected:
   void finish_waiting(uint64_t mask, int result = 0) {
     list<Context*> finished;
     take_waiting(mask, finished);
-    finish_contexts(finished, result);
+    finish_contexts(&g_ceph_context, finished, result);
   }
 
 
index 4afc0a86a92d34cbe0bed7d5d0c3ba14902e187f..b0ad7b1d14ab232fe74b3bd86b57ed75d1626e6d 100644 (file)
@@ -294,9 +294,9 @@ void Paxos::handle_last(MMonPaxos *last)
        extend_lease();
 
        // wake people up
-       finish_contexts(waiting_for_active);
-       finish_contexts(waiting_for_readable);
-       finish_contexts(waiting_for_writeable);
+       finish_contexts(&g_ceph_context, waiting_for_active);
+       finish_contexts(&g_ceph_context, waiting_for_readable);
+       finish_contexts(&g_ceph_context, waiting_for_writeable);
       }
     }
   } else {
@@ -344,10 +344,10 @@ void Paxos::begin(bufferlist& v)
     // we're alone, take it easy
     commit();
     state = STATE_ACTIVE;
-    finish_contexts(waiting_for_active);
-    finish_contexts(waiting_for_commit);
-    finish_contexts(waiting_for_readable);
-    finish_contexts(waiting_for_writeable);
+    finish_contexts(&g_ceph_context, waiting_for_active);
+    finish_contexts(&g_ceph_context, waiting_for_commit);
+    finish_contexts(&g_ceph_context, waiting_for_readable);
+    finish_contexts(&g_ceph_context, waiting_for_writeable);
     update_observers();
     return;
   }
@@ -450,10 +450,10 @@ void Paxos::handle_accept(MMonPaxos *accept)
     extend_lease();
   
     // wake people up
-    finish_contexts(waiting_for_active);
-    finish_contexts(waiting_for_commit);
-    finish_contexts(waiting_for_readable);
-    finish_contexts(waiting_for_writeable);
+    finish_contexts(&g_ceph_context, waiting_for_active);
+    finish_contexts(&g_ceph_context, waiting_for_commit);
+    finish_contexts(&g_ceph_context, waiting_for_readable);
+    finish_contexts(&g_ceph_context, waiting_for_writeable);
   }
   accept->put();
 }
@@ -518,7 +518,7 @@ void Paxos::handle_commit(MMonPaxos *commit)
   
   commit->put();
 
-  finish_contexts(waiting_for_commit);
+  finish_contexts(&g_ceph_context, waiting_for_commit);
 }
 
 void Paxos::extend_lease()
@@ -619,9 +619,9 @@ void Paxos::handle_lease(MMonPaxos *lease)
   trim_to(lease->first_committed);
   
   // kick waiters
-  finish_contexts(waiting_for_active);
+  finish_contexts(&g_ceph_context, waiting_for_active);
   if (is_readable())
-    finish_contexts(waiting_for_readable);
+    finish_contexts(&g_ceph_context, waiting_for_readable);
 
   lease->put();
 }
@@ -780,8 +780,8 @@ void Paxos::peon_init()
   dout(10) << "peon_init -- i am a peon" << dendl;
 
   // no chance to write now!
-  finish_contexts(waiting_for_writeable, -1);
-  finish_contexts(waiting_for_commit, -1);
+  finish_contexts(&g_ceph_context, waiting_for_writeable, -1);
+  finish_contexts(&g_ceph_context, waiting_for_commit, -1);
 }
 
 void Paxos::election_starting()
@@ -790,7 +790,7 @@ void Paxos::election_starting()
   cancel_events();
   new_value.clear();
 
-  finish_contexts(waiting_for_commit, -1);
+  finish_contexts(&g_ceph_context, waiting_for_commit, -1);
 }
 
 
index e2b41e207f15c3bfffc0764e5d1b7e5201cbd107..3f81adde331855096c5e6af2557db4eb076b4d3f 100644 (file)
@@ -3153,7 +3153,7 @@ void FileStore::sync_entry()
     }
     
     lock.Lock();
-    finish_contexts(fin, 0);
+    finish_contexts(&g_ceph_context, fin, 0);
     fin.clear();
     if (!sync_waiters.empty()) {
       dout(10) << "sync_entry more waiters, committing again" << dendl;
index 1830694cef086c0b1da4e7f41e4f1b5cb74152e0..91ec36e14d08a5b5fd949aff0cb73e86351c0dd1 100644 (file)
@@ -1169,7 +1169,7 @@ PG *OSD::get_or_create_pg(const PG::Info& info, epoch_t epoch, int from, int& cr
 
     // ok, create PG locally using provided Info and History
     *pt = new ObjectStore::Transaction;
-    *pfin = new C_Contexts;
+    *pfin = new C_Contexts(&g_ceph_context);
     if (create) {
       pg = _create_lock_new_pg(info.pgid, acting, **pt);
     } else {
@@ -1201,7 +1201,7 @@ PG *OSD::get_or_create_pg(const PG::Info& info, epoch_t epoch, int from, int& cr
       return NULL;
     }
     *pt = new ObjectStore::Transaction;
-    *pfin = new C_Contexts;
+    *pfin = new C_Contexts(&g_ceph_context);
   }
   return pg;
 }
@@ -3189,7 +3189,7 @@ void OSD::handle_osd_map(MOSDMap *m)
     had_map_since = g_clock.now();
   }
 
-  C_Contexts *fin = new C_Contexts;
+  C_Contexts *fin = new C_Contexts(&g_ceph_context);
   if (osdmap->is_up(whoami) &&
       osdmap->get_addr(whoami) == client_messenger->get_myaddr()) {
 
@@ -3802,7 +3802,7 @@ void OSD::kick_pg_split_queue()
 
     // create and lock children
     ObjectStore::Transaction *t = new ObjectStore::Transaction;
-    C_Contexts *fin = new C_Contexts;
+    C_Contexts *fin = new C_Contexts(&g_ceph_context);
     map<pg_t,PG*> children;
     for (set<pg_t>::iterator q = p->second.begin();
         q != p->second.end();
@@ -4042,7 +4042,7 @@ void OSD::handle_pg_create(MOSDPGCreate *m)
     
     if (can_create_pg(pgid)) {
       ObjectStore::Transaction *t = new ObjectStore::Transaction;
-      C_Contexts *fin = new C_Contexts;
+      C_Contexts *fin = new C_Contexts(&g_ceph_context);
 
       PG *pg = _create_lock_new_pg(pgid, creating_pgs[pgid].acting, *t);
       creating_pgs.erase(pgid);
@@ -4673,7 +4673,7 @@ void OSD::generate_backlog(PG *pg)
   map< int, map<pg_t,PG::Query> > query_map;
   map< int, MOSDPGInfo* > info_map;
   ObjectStore::Transaction *t = new ObjectStore::Transaction;
-  C_Contexts *fin = new C_Contexts;
+  C_Contexts *fin = new C_Contexts(&g_ceph_context);
   PG::RecoveryCtx rctx(&query_map, &info_map, 0, &fin->contexts, t);
 
   if (!pg->generate_backlog_epoch) {
index 3e6ccb7a175806abb704e88ba6b5af0c4761dba5..82e86a01d3691a4fa5b45f98b0599928a66e2d63 100644 (file)
@@ -4373,7 +4373,7 @@ int ReplicatedPG::start_recovery_ops(int max)
     dout(10) << __func__ << ": all OSDs in the PG are up-to-date!" << dendl;
     log.reset_recovery_pointers();
     ObjectStore::Transaction *t = new ObjectStore::Transaction;
-    C_Contexts *fin = new C_Contexts;
+    C_Contexts *fin = new C_Contexts(&g_ceph_context);
     finish_recovery(*t, fin->contexts);
     int tr = osd->store->queue_transaction(&osr, t, new ObjectStore::C_DeleteTransaction(t), fin);
     assert(tr == 0);
index af9b20d785f8c86516c729cd0d2c7834cb605a45..536d63fac7e33e4531d199830674cd80a89c8977 100644 (file)
@@ -194,9 +194,9 @@ class Filer {
     } else {
       C_Gather *gack = 0, *gcom = 0;
       if (onack)
-       gack = new C_Gather(onack);
+       gack = new C_Gather(&g_ceph_context, onack);
       if (oncommit)
-       gcom = new C_Gather(oncommit);
+       gcom = new C_Gather(&g_ceph_context, oncommit);
       for (vector<ObjectExtent>::iterator p = extents.begin(); p != extents.end(); p++) {
        vector<OSDOp> ops(1);
        ops[0].op.op = CEPH_OSD_OP_TRIMTRUNC;
@@ -231,9 +231,9 @@ class Filer {
     } else {
       C_Gather *gack = 0, *gcom = 0;
       if (onack)
-       gack = new C_Gather(onack);
+       gack = new C_Gather(&g_ceph_context, onack);
       if (oncommit)
-       gcom = new C_Gather(oncommit);
+       gcom = new C_Gather(&g_ceph_context, oncommit);
       for (vector<ObjectExtent>::iterator p = extents.begin(); p != extents.end(); p++) {
        if (p->offset == 0 && p->length == layout->fl_object_size)
          objecter->remove(p->oid, p->oloc,
index a7b8cd13deb0e2f0cd948f0cc7c3efc0bea5a631..f2a46811d01931c0b66e2cb97b5f0b67bbdd3c24 100644 (file)
@@ -195,7 +195,7 @@ void Journaler::_finish_read_head(int r, bufferlist& bl)
     state = STATE_ACTIVE;
     list<Context*> ls;
     ls.swap(waitfor_recover);
-    finish_contexts(ls, 0);
+    finish_contexts(&g_ceph_context, ls, 0);
     return;
   } 
 
@@ -209,7 +209,7 @@ void Journaler::_finish_read_head(int r, bufferlist& bl)
            << magic << "'" << dendl;
     list<Context*> ls;
     ls.swap(waitfor_recover);
-    finish_contexts(ls, -EINVAL);
+    finish_contexts(&g_ceph_context, ls, -EINVAL);
     return;
   }
 
@@ -283,7 +283,7 @@ void Journaler::_finish_probe_end(int r, uint64_t end)
   // done.
   list<Context*> ls;
   ls.swap(waitfor_recover);
-  finish_contexts(ls, 0);
+  finish_contexts(&g_ceph_context, ls, 0);
 }
 
 class Journaler::C_RereadHeadProbe : public Context
@@ -408,7 +408,7 @@ void Journaler::_finish_flush(int r, uint64_t start, utime_t stamp)
   while (!waitfor_safe.empty()) {
     if (waitfor_safe.begin()->first > safe_pos)
       break;
-    finish_contexts(waitfor_safe.begin()->second);
+    finish_contexts(&g_ceph_context, waitfor_safe.begin()->second);
     waitfor_safe.erase(waitfor_safe.begin());
   }
 }
@@ -1010,7 +1010,7 @@ void Journaler::_trim_finish(int r, uint64_t to)
   // finishers?
   while (!waitfor_trim.empty() &&
         waitfor_trim.begin()->first <= trimmed_pos) {
-    finish_contexts(waitfor_trim.begin()->second, 0);
+    finish_contexts(&g_ceph_context, waitfor_trim.begin()->second, 0);
     waitfor_trim.erase(waitfor_trim.begin());
   }
 }
index e64d85d7c06589689559458395d6b5ffe75ea762..f713afa726db7b39d2ed1c48add89d181c7c6112 100644 (file)
@@ -520,7 +520,7 @@ void ObjectCacher::bh_read_finish(int poolid, sobject_t oid, loff_t start, uint6
            p++)
         ls.splice(ls.end(), p->second);
       bh->waitfor_read.clear();
-      finish_contexts(ls);
+      finish_contexts(&g_ceph_context, ls);
 
       // clean up?
       ob->try_merge_bh(bh);
@@ -617,7 +617,7 @@ void ObjectCacher::lock_ack(int poolid, list<sobject_t>& oids, tid_t tid)
                << " tid " << tid << " obsolete" << dendl;
     }
 
-    finish_contexts(ls);
+    finish_contexts(&g_ceph_context, ls);
 
   }
 }
@@ -678,7 +678,7 @@ void ObjectCacher::bh_write_ack(int poolid, sobject_t oid, loff_t start, uint64_
       list<Context*> ls;
       ls.splice(ls.begin(), ob->waitfor_ack[tid]);
       ob->waitfor_ack.erase(tid);
-      finish_contexts(ls);
+      finish_contexts(&g_ceph_context, ls);
     }
 
     // is the entire object set now clean?
@@ -713,7 +713,7 @@ void ObjectCacher::bh_write_commit(int poolid, sobject_t oid, loff_t start, uint
       list<Context*> ls;
       ls.splice(ls.begin(), ob->waitfor_commit[tid]);
       ob->waitfor_commit.erase(tid);
-      finish_contexts(ls);
+      finish_contexts(&g_ceph_context, ls);
     }
 
     // is the entire object set now clean and fully committed?
@@ -1488,7 +1488,7 @@ bool ObjectCacher::flush_set(ObjectSet *oset, Context *onfinish)
     if (!flush(ob)) {
       // we'll need to gather...
       if (!gather && onfinish) 
-        gather = new C_Gather(onfinish);
+        gather = new C_Gather(&g_ceph_context, onfinish);
       safe = false;
 
       dout(10) << "flush_set " << oset << " will wait for ack tid " 
@@ -1535,7 +1535,7 @@ bool ObjectCacher::commit_set(ObjectSet *oset, Context *onfinish)
       dout(10) << "commit_set " << oset << " " << *ob 
                << " will finish on commit tid " << ob->last_write_tid
                << dendl;
-      if (!gather && onfinish) gather = new C_Gather(onfinish);
+      if (!gather && onfinish) gather = new C_Gather(&g_ceph_context, onfinish);
       safe = false;
       if (gather)
         ob->waitfor_commit[ob->last_write_tid].push_back( gather->new_sub() );
@@ -1735,7 +1735,7 @@ void ObjectCacher::kick_sync_writers(ObjectSet *oset)
     ls.splice(ls.begin(), ob->waitfor_wr);
   }
 
-  finish_contexts(ls);
+  finish_contexts(&g_ceph_context, ls);
 }
 
 void ObjectCacher::kick_sync_readers(ObjectSet *oset)
@@ -1756,7 +1756,7 @@ void ObjectCacher::kick_sync_readers(ObjectSet *oset)
     ls.splice(ls.begin(), ob->waitfor_rd);
   }
 
-  finish_contexts(ls);
+  finish_contexts(&g_ceph_context, ls);
 }
 
 
index 75f60a82ab033e91a7afdd057f043a6d0a535dc3..cfa17ea83ce709b01bb791b49b1d3252c902d316 100644 (file)
@@ -1061,7 +1061,7 @@ public:
       read_trunc(extents[0].oid, extents[0].oloc, extents[0].offset, extents[0].length,
           snap, bl, flags, trunc_size, trunc_seq, onfinish);
     } else {
-      C_Gather *g = new C_Gather;
+      C_Gather *g = new C_Gather(&g_ceph_context);
       vector<bufferlist> resultbl(extents.size());
       int i=0;
       for (vector<ObjectExtent>::iterator p = extents.begin(); p != extents.end(); p++) {
@@ -1085,9 +1085,9 @@ public:
     } else {
       C_Gather *gack = 0, *gcom = 0;
       if (onack)
-       gack = new C_Gather(onack);
+       gack = new C_Gather(&g_ceph_context, onack);
       if (oncommit)
-       gcom = new C_Gather(oncommit);
+       gcom = new C_Gather(&g_ceph_context, oncommit);
       for (vector<ObjectExtent>::iterator p = extents.begin(); p != extents.end(); p++) {
        bufferlist cur;
        for (map<__u32,__u32>::iterator bit = p->buffer_extents.begin();
index a065e19f3e2f855a742cbbd05e50c659139cfdd5..5b64aecd54b3b428250d594c68a14b487e5842f4 100644 (file)
@@ -25,7 +25,7 @@ public:
 };
 
 TEST(ContextGather, Constructor) {
-  C_Gather *gather = new C_Gather();
+  C_Gather *gather = new C_Gather(&g_ceph_context );
   EXPECT_TRUE(gather->empty());
   EXPECT_EQ(0, gather->get_num());
   EXPECT_EQ(0, gather->get_num_remaining());
@@ -33,7 +33,7 @@ TEST(ContextGather, Constructor) {
 }
 
 TEST(ContextGather, OneSub) {
-  C_Gather *gather = new C_Gather();
+  C_Gather *gather = new C_Gather(&g_ceph_context);
   Context *sub = gather->new_sub();
   EXPECT_EQ(1, gather->get_num());
   EXPECT_EQ(1, gather->get_num_remaining());
@@ -50,7 +50,7 @@ TEST(ContextGather, OneSub) {
 }
 
 TEST(ContextGather, ManySubs) {
-  C_Gather *gather = new C_Gather();
+  C_Gather *gather = new C_Gather(&g_ceph_context);
   int sub_count = 8;
   bool finish_called = false;
   int result = 0;
@@ -81,7 +81,7 @@ TEST(ContextGather, ManySubs) {
 }
 
 TEST(ContextGather, AlternatingSubCreateFinish) {
-  C_Gather *gather = new C_Gather();
+  C_Gather *gather = new C_Gather(&g_ceph_context);
   int sub_count = 8;
   bool finish_called = false;
   int result = 0;