]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: register flush completions directly on the Transaction
authorSage Weil <sage@redhat.com>
Fri, 9 Feb 2018 21:58:15 +0000 (15:58 -0600)
committerSage Weil <sage@redhat.com>
Wed, 4 Apr 2018 13:26:54 +0000 (08:26 -0500)
No need to awkward list passed as an arg; all of these callbacks end up
on the Transaction anyway.

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

index 6dfeb9adf3db989fbcdc23e3edfe216c16071cf4..9c7abe989217c12477f54416efffd7ee10cbeb8f 100644 (file)
@@ -5777,17 +5777,15 @@ struct FlushState {
 };
 typedef ceph::shared_ptr<FlushState> FlushStateRef;
 
-void PG::start_flush(ObjectStore::Transaction *t,
-                    list<Context *> *on_applied,
-                    list<Context *> *on_safe)
+void PG::start_flush(ObjectStore::Transaction *t)
 {
   // flush in progress ops
   FlushStateRef flush_trigger (std::make_shared<FlushState>(
                                this, get_osdmap()->get_epoch()));
   t->nop();
   flushes_in_progress++;
-  on_applied->push_back(new ContainerContext<FlushStateRef>(flush_trigger));
-  on_safe->push_back(new ContainerContext<FlushStateRef>(flush_trigger));
+  t->register_on_applied(new ContainerContext<FlushStateRef>(flush_trigger));
+  t->register_on_commit(new ContainerContext<FlushStateRef>(flush_trigger));
 }
 
 void PG::reset_interval_flush()
@@ -7821,10 +7819,7 @@ PG::RecoveryState::Active::Active(my_context ctx)
   assert(!pg->backfill_reserved);
   assert(pg->is_primary());
   ldout(pg->cct, 10) << "In Active, about to call activate" << dendl;
-  pg->start_flush(
-    context< RecoveryMachine >().get_cur_transaction(),
-    context< RecoveryMachine >().get_on_applied_context_list(),
-    context< RecoveryMachine >().get_on_safe_context_list());
+  pg->start_flush(context< RecoveryMachine >().get_cur_transaction());
   pg->activate(*context< RecoveryMachine >().get_cur_transaction(),
               pg->get_osdmap()->get_epoch(),
               *context< RecoveryMachine >().get_on_safe_context_list(),
@@ -8235,10 +8230,7 @@ PG::RecoveryState::ReplicaActive::ReplicaActive(my_context ctx)
   context< RecoveryMachine >().log_enter(state_name);
 
   PG *pg = context< RecoveryMachine >().pg;
-  pg->start_flush(
-    context< RecoveryMachine >().get_cur_transaction(),
-    context< RecoveryMachine >().get_on_applied_context_list(),
-    context< RecoveryMachine >().get_on_safe_context_list());
+  pg->start_flush(context< RecoveryMachine >().get_cur_transaction());
 }
 
 
@@ -8344,10 +8336,7 @@ PG::RecoveryState::Stray::Stray(my_context ctx)
     ldout(pg->cct,10) << __func__ << " pool is deleted" << dendl;
     post_event(DeleteStart());
   } else {
-    pg->start_flush(
-      context< RecoveryMachine >().get_cur_transaction(),
-      context< RecoveryMachine >().get_on_applied_context_list(),
-      context< RecoveryMachine >().get_on_safe_context_list());
+    pg->start_flush(context< RecoveryMachine >().get_cur_transaction());
   }
 }
 
@@ -8786,10 +8775,7 @@ boost::statechart::result PG::RecoveryState::GetLog::react(const GotLog&)
                        msg->info, msg->log, msg->missing,
                        auth_log_shard);
   }
-  pg->start_flush(
-    context< RecoveryMachine >().get_cur_transaction(),
-    context< RecoveryMachine >().get_on_applied_context_list(),
-    context< RecoveryMachine >().get_on_safe_context_list());
+  pg->start_flush(context< RecoveryMachine >().get_cur_transaction());
   return transit< GetMissing >();
 }
 
index bc583ac0743927601c7e77271faa77c07c1faf1e..b269065acaf90a2a2e2e4c279d5dd0ebe563c723 100644 (file)
@@ -2915,9 +2915,7 @@ protected:
     ObjectStore::Transaction *t);
   void on_new_interval();
   virtual void _on_new_interval() = 0;
-  void start_flush(ObjectStore::Transaction *t,
-                  list<Context *> *on_applied,
-                  list<Context *> *on_safe);
+  void start_flush(ObjectStore::Transaction *t);
   void set_last_peering_reset();
 
   void update_history(const pg_history_t& history);