]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: clone_range of len 0 creates but does not size object 12343/head
authorSage Weil <sage@redhat.com>
Tue, 6 Dec 2016 19:32:52 +0000 (14:32 -0500)
committerSage Weil <sage@redhat.com>
Thu, 15 Dec 2016 19:20:28 +0000 (14:20 -0500)
This mimics, roughly,

 open(..., O_WRONLY|O_CREAT, ...)
 seek(...)
 if (len > 0)
   write(...)

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

index addc5c9bfd310bf60a9e0422d709b788e27e5c8e..212abc4f7821ac195c3c9d226ac7528beddc5d6e 100644 (file)
@@ -8751,17 +8751,19 @@ int BlueStore::_clone_range(TransContext *txc,
   newo->exists = true;
   _assign_nid(txc, newo);
 
-  if (g_conf->bluestore_clone_cow) {
-    _do_zero(txc, c, newo, dstoff, length);
-    _do_clone_range(txc, c, oldo, newo, srcoff, length, dstoff);
-  } else {
-    bufferlist bl;
-    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 (length > 0) {
+    if (g_conf->bluestore_clone_cow) {
+      _do_zero(txc, c, newo, dstoff, length);
+      _do_clone_range(txc, c, oldo, newo, srcoff, length, dstoff);
+    } else {
+      bufferlist bl;
+      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);