From fbd5cd4a17fe7dac63c7214ec3dcc6cb2b5294db Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 27 Jan 2016 14:20:29 -0500 Subject: [PATCH] Revert "BlueStore: fix dest onode process logic of clone" 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 --- src/os/bluestore/BlueStore.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ef67d80b62e2..95e5bb56e3ef 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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; -- 2.47.3