]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: copy: specify the temp_oid in the caller
authorGreg Farnum <greg@inktank.com>
Mon, 30 Sep 2013 23:59:52 +0000 (16:59 -0700)
committerGreg Farnum <greg@inktank.com>
Tue, 1 Oct 2013 23:29:44 +0000 (16:29 -0700)
Signed-off-by: Greg Farnum <greg@inktank.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index cfac7dd7db24b9f5bf447b45d94c5fb794edd5fc..c3a572509bccb39857c945473e1fe7ea264ab9ef 100644 (file)
@@ -3764,7 +3764,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& 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;
       }
 
index 5f0c97b3716766c7484f30f86d23821367c9953f..e4f6848d6c03f6b2908f7912b05fcc14cd7c6bda 100644 (file)
@@ -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<CopyOp> CopyOpRef;
@@ -723,7 +725,9 @@ protected:
   // -- 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);