From: myoungwon oh Date: Wed, 2 Dec 2020 02:20:18 +0000 (+0900) Subject: osd: move setting callback and manifest_ops to caller X-Git-Tag: v16.1.0~374^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=accd24a2683f982cd05306589461b3d1c7dd0181;p=ceph.git osd: move setting callback and manifest_ops to caller Signed-off-by: Myoungwon Oh --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index dbfb596feb7b..cdeca5150728 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -3352,9 +3352,13 @@ bool PrimaryLogPG::inc_refcount_by_set(OpContext* ctx, object_manifest_t& set_ch * the reference the targe object has prior to update object_manifest in object_info_t. * So, call directly refcount_manifest. */ - RefCountCallback *fin = new RefCountCallback(ctx, osd_op); - refcount_manifest(ctx->obs->oi.soid, p->first, - refcount_t::INCREMENT_REF, fin, std::nullopt); + C_SetManifestRefCountDone* fin = new C_SetManifestRefCountDone( + new RefCountCallback(ctx, osd_op), + ctx->obs->oi.soid); + ceph_tid_t tid = refcount_manifest(ctx->obs->oi.soid, p->first, + refcount_t::INCREMENT_REF, fin, std::nullopt); + manifest_ops[ctx->obs->oi.soid] = std::make_shared(fin->cb, tid); + ctx->obc->start_block(); return true; } else if (inc_ref_count < 0) { hobject_t src = ctx->obs->oi.soid; @@ -3463,15 +3467,9 @@ ceph_tid_t PrimaryLogPG::refcount_manifest(hobject_t src_soid, hobject_t tgt_soi ceph_assert(0 == "unrecognized type"); } - Context *c = nullptr, *fin = nullptr; + Context *c = nullptr; if (cb) { - if (type == refcount_t::INCREMENT_REF || - type == refcount_t::DECREMENT_REF) { - fin = new C_SetManifestRefCountDone(static_cast(cb), src_soid); - } else if (type == refcount_t::CREATE_OR_GET_REF) { - fin = cb; - } - c = new C_OnFinisher(fin, osd->get_objecter_finisher(get_pg_shard())); + c = new C_OnFinisher(cb, osd->get_objecter_finisher(get_pg_shard())); } object_locator_t oloc(tgt_soid); @@ -3481,13 +3479,6 @@ ceph_tid_t PrimaryLogPG::refcount_manifest(hobject_t src_soid, hobject_t tgt_soi tgt_soid.oid, oloc, obj_op, SnapContext(), ceph::real_clock::from_ceph_timespec(src_obc->obs.oi.mtime), flags, c); - if (cb) { - if (type == refcount_t::INCREMENT_REF || - type == refcount_t::DECREMENT_REF) { - manifest_ops[src_soid] = std::make_shared(static_cast(cb), tid); - src_obc->start_block(); - } - } return tid; } @@ -6828,9 +6819,13 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) // start ctx->op_finishers[ctx->current_osd_subop_num].reset( new SetManifestFinisher(osd_op)); - RefCountCallback *fin = new RefCountCallback(ctx, osd_op); - refcount_manifest(ctx->obc->obs.oi.soid, target, + C_SetManifestRefCountDone* fin = new C_SetManifestRefCountDone( + new RefCountCallback(ctx, osd_op), + soid); + ceph_tid_t tid = refcount_manifest(soid, target, refcount_t::INCREMENT_REF, fin, std::nullopt); + manifest_ops[soid] = std::make_shared(fin->cb, tid); + ctx->obc->start_block(); result = -EINPROGRESS; } else { // finish