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;
};
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
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;
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;
}
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<CopyOp> CopyOpRef;
// -- copyfrom --
map<hobject_t, CopyOpRef> 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);