From: Sage Weil Date: Fri, 9 Feb 2018 22:05:46 +0000 (-0600) Subject: osd/PG: remove RecoveryCtx on_applied and on_commit X-Git-Tag: v13.1.0~390^2~58 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=bc9436bcb506e690dffdb3614009af9bde5133c4;p=ceph.git osd/PG: remove RecoveryCtx on_applied and on_commit These were awkward and unnecessary. Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 98f7e35e01931..1430c23e0340d 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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 > *query_map = new map >; map > > *notify_list = new map > >; map > > *info_map = new map > >; - 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(), diff --git a/src/osd/PG.cc b/src/osd/PG.cc index c8cdb89818378..9934a5c9bdfc9 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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().get_cur_transaction(); pg->on_removal(t); - RecoveryCtx *rctx = context().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( diff --git a/src/osd/PG.h b/src/osd/PG.h index 66b16f197194e..c15d4be09611a 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -977,8 +977,6 @@ public: map > *query_map; map > > *info_map; map > > *notify_list; - C_Contexts *on_applied; - C_Contexts *on_safe; ObjectStore::Transaction *transaction; ThreadPool::TPHandle* handle; RecoveryCtx(map > *query_map, @@ -986,13 +984,9 @@ public: vector > > *info_map, map > > *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) {}