]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: add cow clone_range via _do_clone_range
authorSage Weil <sage@redhat.com>
Fri, 16 Sep 2016 14:15:33 +0000 (10:15 -0400)
committerSage Weil <sage@redhat.com>
Fri, 16 Sep 2016 15:15:23 +0000 (11:15 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index 2d55127f55c0a13c9cbf669504162d3cb5868b63..8e3e042ec666fe6a7a5fb78767239721eb01b34a 100644 (file)
@@ -8152,15 +8152,19 @@ int BlueStore::_clone_range(TransContext *txc,
   newo->exists = true;
   _assign_nid(txc, newo);
 
-  r = _do_read(c.get(), oldo, srcoff, length, bl, 0);
-  if (r < 0)
-    goto out;
-  r = _do_write(txc, c, newo, dstoff, bl.length(), bl, 0);
-  if (r < 0)
-    goto out;
+  if (g_conf->bluestore_clone_cow) {
+    _do_zero(txc, c, newo, dstoff, length);
+    _do_clone_range(txc, c, oldo, newo, srcoff, length, dstoff);
+  } else {
+    r = _do_read(c.get(), oldo, srcoff, length, bl, 0);
+    if (r < 0)
+      goto out;
+    r = _do_write(txc, c, newo, dstoff, bl.length(), bl, 0);
+    if (r < 0)
+      goto out;
+  }
 
   txc->write_onode(newo);
-
   r = 0;
 
  out: