From 9dbb9f93557d1efe83129ed792ac129c0effef63 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 2 Apr 2018 20:57:32 -0500 Subject: [PATCH] osd: check for rctx contexts instead of adding nop() to transaction This is cheaper and more explicit. Signed-off-by: Sage Weil --- src/osd/OSD.cc | 14 ++++++-------- src/osd/PG.cc | 2 -- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 8b93650b46c8f..5af036a240602 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 9a551656d471b..2f1b8391fb772 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -5791,7 +5791,6 @@ void PG::start_flush(ObjectStore::Transaction *t) // flush in progress ops FlushStateRef flush_trigger (std::make_shared( this, get_osdmap()->get_epoch())); - t->nop(); flushes_in_progress++; t->register_on_applied(new ContainerContext(flush_trigger)); t->register_on_commit(new ContainerContext(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(); -- 2.39.5