]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: check for rctx contexts instead of adding nop() to transaction
authorSage Weil <sage@redhat.com>
Tue, 3 Apr 2018 01:57:32 +0000 (20:57 -0500)
committerSage Weil <sage@redhat.com>
Wed, 4 Apr 2018 13:27:01 +0000 (08:27 -0500)
This is cheaper and more explicit.

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

index 8b93650b46c8f0f84c77db6c1e11c49bec6ffecb..5af036a24060286ab9fba2b255b442efe911b0cf 100644 (file)
@@ -8183,7 +8183,7 @@ PG::RecoveryCtx OSD::create_context()
 void OSD::dispatch_context_transaction(PG::RecoveryCtx &ctx, PG *pg,
                                        ThreadPool::TPHandle *handle)
 {
-  if (!ctx.transaction->empty()) {
+  if (!ctx.transaction->empty() || ctx.transaction->has_contexts()) {
     int tr = store->queue_transaction(
       pg->ch,
       std::move(*ctx.transaction), TrackedOpRef(), handle);
@@ -8205,19 +8205,17 @@ void OSD::dispatch_context(PG::RecoveryCtx &ctx, PG *pg, OSDMapRef curmap,
     do_queries(*ctx.query_map, curmap);
     do_infos(*ctx.info_map, curmap);
   }
-  delete ctx.notify_list;
-  delete ctx.query_map;
-  delete ctx.info_map;
-  if (ctx.transaction->empty() || !pg) {
-    delete ctx.transaction;
-  } else {
+  if ((!ctx.transaction->empty() || ctx.transaction->has_contexts()) && pg) {
     int tr = store->queue_transaction(
       pg->ch,
       std::move(*ctx.transaction), TrackedOpRef(),
       handle);
-    delete (ctx.transaction);
     assert(tr == 0);
   }
+  delete ctx.notify_list;
+  delete ctx.query_map;
+  delete ctx.info_map;
+  delete ctx.transaction;
 }
 
 void OSD::discard_context(PG::RecoveryCtx& ctx)
index 9a551656d471bc4fa53dce95c4c8069b77435ce0..2f1b8391fb77262ffabab4c2b33a3bcd6779a936 100644 (file)
@@ -5791,7 +5791,6 @@ 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++;
   t->register_on_applied(new ContainerContext<FlushStateRef>(flush_trigger));
   t->register_on_commit(new ContainerContext<FlushStateRef>(flush_trigger));
@@ -7759,7 +7758,6 @@ PG::RecoveryState::Clean::Clean(my_context ctx)
   }
   Context *c = pg->finish_recovery();
   context< RecoveryMachine >().get_cur_transaction()->register_on_commit(c);
-  context< RecoveryMachine >().get_cur_transaction()->nop();
 
   if (pg->is_active()) {
     pg->mark_clean();