From: Greg Farnum Date: Mon, 30 Sep 2013 23:59:52 +0000 (-0700) Subject: ReplicatedPG: copy: specify the temp_oid in the caller X-Git-Tag: v0.71~22^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=010ff3759efc650d766348ab988c302996b8fc50;p=ceph.git ReplicatedPG: copy: specify the temp_oid in the caller Signed-off-by: Greg Farnum --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index cfac7dd7db24..c3a572509bcc 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -3764,7 +3764,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops) result = -EINVAL; break; } - result = start_copy(ctx, ctx->obc, src, src_oloc, src_version); + hobject_t temp_target = generate_temp_object(); + result = start_copy(ctx, ctx->obc, src, src_oloc, src_version, + temp_target); if (result < 0) goto fail; result = -EINPROGRESS; @@ -4380,7 +4382,8 @@ struct C_Copyfrom : public Context { }; int ReplicatedPG::start_copy(OpContext *ctx, ObjectContextRef obc, - hobject_t src, object_locator_t oloc, version_t version) + hobject_t src, object_locator_t oloc, version_t version, + const hobject_t& temp_dest_oid) { const hobject_t& dest = ctx->obs->oi.soid; dout(10) << __func__ << " " << dest << " ctx " << ctx @@ -4395,7 +4398,7 @@ int ReplicatedPG::start_copy(OpContext *ctx, ObjectContextRef obc, cancel_copy(cop); } - CopyOpRef cop(new CopyOp(ctx, obc, src, oloc, version)); + CopyOpRef cop(new CopyOp(ctx, obc, src, oloc, version, temp_dest_oid)); copy_ops[dest] = cop; ctx->copy_op = cop; ++obc->copyfrom_readside; @@ -4466,7 +4469,6 @@ void ReplicatedPG::process_copy_chunk(hobject_t oid, tid_t tid, int r) if (cop->temp_cursor.is_initial()) { cop->temp_coll = get_temp_coll(&tctx->local_t); - cop->temp_oid = generate_temp_object(); repop->ctx->new_temp_oid = cop->temp_oid; } diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 5f0c97b37167..e4f6848d6c03 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -115,11 +115,13 @@ public: hobject_t temp_oid; object_copy_cursor_t temp_cursor; - CopyOp(OpContext *c, ObjectContextRef _obc, hobject_t s, object_locator_t l, version_t v) + CopyOp(OpContext *c, ObjectContextRef _obc, hobject_t s, object_locator_t l, + version_t v, const hobject_t& dest) : ctx(c), obc(_obc), src(s), oloc(l), version(v), objecter_tid(0), size(0), - rval(-1) + rval(-1), + temp_oid(dest) {} }; typedef boost::shared_ptr CopyOpRef; @@ -723,7 +725,9 @@ protected: // -- copyfrom -- map copy_ops; - int start_copy(OpContext *ctx, ObjectContextRef obc, hobject_t src, object_locator_t oloc, version_t version); + int start_copy(OpContext *ctx, ObjectContextRef obc, hobject_t src, + object_locator_t oloc, version_t version, + const hobject_t& temp_dest_oid); void process_copy_chunk(hobject_t oid, tid_t tid, int r); void _write_copy_chunk(CopyOpRef cop, ObjectStore::Transaction *t); void _copy_some(ObjectContextRef obc, CopyOpRef cop);