]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: remove RecoveryCtx on_applied and on_commit
authorSage Weil <sage@redhat.com>
Fri, 9 Feb 2018 22:05:46 +0000 (16:05 -0600)
committerSage Weil <sage@redhat.com>
Wed, 4 Apr 2018 13:26:55 +0000 (08:26 -0500)
These were awkward and unnecessary.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PG.h

index 98f7e35e019314c3b99c67256e1990df5998865e..1430c23e0340dcd28639af290459bc39a54ed1c4 100644 (file)
@@ -8138,16 +8138,13 @@ void OSD::handle_pg_create(OpRequestRef op)
 PG::RecoveryCtx OSD::create_context()
 {
   ObjectStore::Transaction *t = new ObjectStore::Transaction;
-  C_Contexts *on_applied = new C_Contexts(cct);
-  C_Contexts *on_safe = new C_Contexts(cct);
   map<int, map<spg_t,pg_query_t> > *query_map =
     new map<int, map<spg_t, pg_query_t> >;
   map<int,vector<pair<pg_notify_t, PastIntervals> > > *notify_list =
     new map<int, vector<pair<pg_notify_t, PastIntervals> > >;
   map<int,vector<pair<pg_notify_t, PastIntervals> > > *info_map =
     new map<int,vector<pair<pg_notify_t, PastIntervals> > >;
-  PG::RecoveryCtx rctx(query_map, info_map, notify_list,
-                      on_applied, on_safe, t);
+  PG::RecoveryCtx rctx(query_map, info_map, notify_list, t);
   return rctx;
 }
 
@@ -8155,18 +8152,12 @@ void OSD::dispatch_context_transaction(PG::RecoveryCtx &ctx, PG *pg,
                                        ThreadPool::TPHandle *handle)
 {
   if (!ctx.transaction->empty()) {
-    if (ctx.on_applied)
-      ctx.transaction->register_on_applied(ctx.on_applied);
-    if (ctx.on_safe)
-      ctx.transaction->register_on_commit(ctx.on_safe);
     int tr = store->queue_transaction(
       pg->ch,
       std::move(*ctx.transaction), TrackedOpRef(), handle);
     assert(tr == 0);
     delete (ctx.transaction);
     ctx.transaction = new ObjectStore::Transaction;
-    ctx.on_applied = new C_Contexts(cct);
-    ctx.on_safe = new C_Contexts(cct);
   }
 }
 
@@ -8185,17 +8176,9 @@ void OSD::dispatch_context(PG::RecoveryCtx &ctx, PG *pg, OSDMapRef curmap,
   delete ctx.notify_list;
   delete ctx.query_map;
   delete ctx.info_map;
-  if ((ctx.on_applied->empty() &&
-       ctx.on_safe->empty() &&
-       ctx.transaction->empty()) || !pg) {
+  if (ctx.transaction->empty() || !pg) {
     delete ctx.transaction;
-    delete ctx.on_applied;
-    delete ctx.on_safe;
   } else {
-    if (ctx.on_applied)
-      ctx.transaction->register_on_applied(ctx.on_applied);
-    if (ctx.on_safe)
-      ctx.transaction->register_on_commit(ctx.on_safe);
     int tr = store->queue_transaction(
       pg->ch,
       std::move(*ctx.transaction), TrackedOpRef(),
index c8cdb898183786b2337b7a73d601436f451739f3..9934a5c9bdfc9510e2be24fd4bc624970dc0a074 100644 (file)
@@ -3762,7 +3762,7 @@ void PG::read_state(ObjectStore *store)
       set_role(-1);
   }
 
-  PG::RecoveryCtx rctx(0, 0, 0, 0, 0, new ObjectStore::Transaction);
+  PG::RecoveryCtx rctx(0, 0, 0, new ObjectStore::Transaction);
   handle_initialize(&rctx);
   // note: we don't activate here because we know the OSD will advance maps
   // during boot.
@@ -8500,9 +8500,7 @@ PG::RecoveryState::Deleting::Deleting(my_context ctx)
   pg->deleting = true;
   ObjectStore::Transaction* t = context<RecoveryMachine>().get_cur_transaction();
   pg->on_removal(t);
-  RecoveryCtx *rctx = context<RecoveryMachine>().get_recovery_ctx();
-  Context *fin = new C_DeleteMore(pg, pg->get_osdmap()->get_epoch());
-  rctx->transaction->register_on_commit(fin);
+  t->register_on_commit(new C_DeleteMore(pg, pg->get_osdmap()->get_epoch()));
 }
 
 boost::statechart::result PG::RecoveryState::Deleting::react(
index 66b16f197194ec23846ebfb94585f9f74cb72364..c15d4be09611af87969d9cad5ac268e4c31b30fd 100644 (file)
@@ -977,8 +977,6 @@ public:
     map<int, map<spg_t, pg_query_t> > *query_map;
     map<int, vector<pair<pg_notify_t, PastIntervals> > > *info_map;
     map<int, vector<pair<pg_notify_t, PastIntervals> > > *notify_list;
-    C_Contexts *on_applied;
-    C_Contexts *on_safe;
     ObjectStore::Transaction *transaction;
     ThreadPool::TPHandle* handle;
     RecoveryCtx(map<int, map<spg_t, pg_query_t> > *query_map,
@@ -986,13 +984,9 @@ public:
                    vector<pair<pg_notify_t, PastIntervals> > > *info_map,
                map<int,
                    vector<pair<pg_notify_t, PastIntervals> > > *notify_list,
-               C_Contexts *on_applied,
-               C_Contexts *on_safe,
                ObjectStore::Transaction *transaction)
       : query_map(query_map), info_map(info_map), 
        notify_list(notify_list),
-       on_applied(on_applied),
-       on_safe(on_safe),
        transaction(transaction),
         handle(NULL) {}
 
@@ -1000,8 +994,6 @@ public:
       : query_map(&(buf.query_map)),
        info_map(&(buf.info_map)),
        notify_list(&(buf.notify_list)),
-       on_applied(rctx.on_applied),
-       on_safe(rctx.on_safe),
        transaction(rctx.transaction),
         handle(rctx.handle) {}