From: Sage Weil Date: Fri, 25 Oct 2013 04:45:50 +0000 (-0700) Subject: osd/ReplicatedPG: use finish_ctx for finish_promote X-Git-Tag: v0.75~45^2~48 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ca86656e745f0b1f2367921cbb2335445cf43ca8;p=ceph.git osd/ReplicatedPG: use finish_ctx for finish_promote Use the common code here to avoid duplicating this logic. Signed-off-by: Sage Weil --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 549686a08a64..166eca1137a7 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4707,45 +4707,29 @@ void ReplicatedPG::finish_promote(int r, OpRequestRef op, RepGather *repop = simple_repop_create(obc); OpContext *tctx = repop->ctx; + tctx->at_version = get_next_version(); + + ++tctx->delta_stats.num_objects; + tctx->new_obs.exists = true; + tctx->new_snapset.head_exists = true; - object_stat_sum_t delta; - ++delta.num_objects; - obc->obs.exists = true; if (whiteout) { // create a whiteout tctx->op_t.touch(coll, soid); - obc->obs.oi.set_flag(object_info_t::FLAG_WHITEOUT); + tctx->new_obs.oi.set_flag(object_info_t::FLAG_WHITEOUT); } else { tctx->op_t.swap(results->final_tx); if (results->started_temp_obj) { tctx->discard_temp_oid = temp_obj; } - delta.num_bytes += results->object_size; - obc->obs.oi.category = results->category; + tctx->delta_stats.num_bytes += results->object_size; + tctx->new_obs.oi.category = results->category; tctx->user_at_version = results->user_version; } - info.stats.stats.add(delta, obc->obs.oi.category); - tctx->at_version.epoch = get_next_version(); - - tctx->log.push_back(pg_log_entry_t( - pg_log_entry_t::MODIFY, - soid, - tctx->at_version, - tctx->obs->oi.version, - tctx->user_at_version, - osd_reqid_t(), - repop->ctx->mtime)); - - // set object and snapset attrs - bufferlist bv(sizeof(tctx->new_obs.oi)); - ::encode(tctx->new_obs.oi, bv); - tctx->op_t.setattr(coll, soid, OI_ATTR, bv); - - bufferlist bss; - ::encode(tctx->new_snapset, bss); - tctx->op_t.setattr(coll, soid, SS_ATTR, bss); repop->ondone = new C_KickBlockedObject(obc, this); + + finish_ctx(tctx); simple_repop_submit(repop); }