]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "BlueStore: fix dest onode process logic of clone"
authorSage Weil <sage@redhat.com>
Wed, 27 Jan 2016 19:20:29 +0000 (14:20 -0500)
committerSage Weil <sage@redhat.com>
Wed, 27 Jan 2016 19:20:29 +0000 (14:20 -0500)
This reverts commit 1c70f86316e5ff29ef7168ebfb3513def770b436.

The truncate is cheap if the object is empty, and we need to
call _assign_nid unconditionally.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index ef67d80b62e21ddf5a3c4dd7666ea9debf0ec4e8..95e5bb56e3efbe2b935dff416fc929acae599617 100644 (file)
@@ -5954,22 +5954,18 @@ int BlueStore::_clone(TransContext *txc,
     r = -ENOENT;
     goto out;
   }
-
-  newo = c->get_onode(new_oid, false);
-  if (newo) {
-    r = _do_truncate(txc, c, newo, 0);
-    if (r < 0)
-      goto out;
-  } else {
-    newo = c->get_onode(new_oid, true);
-    _assign_nid(txc, newo);
-  }
+  newo = c->get_onode(new_oid, true);
   assert(newo);
   newo->exists = true;
+  _assign_nid(txc, newo);
 
   // data
   oldo->flush();
 
+  r = _do_truncate(txc, c, newo, 0);
+  if (r < 0)
+    goto out;
+
   if (g_conf->bluestore_clone_cow) {
     EnodeRef e = c->get_enode(newo->oid.hobj.get_hash());
     bool marked = false;