]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: use bl::splice() instead of bl::claim_append_piecewise().
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 19 Aug 2020 14:39:15 +0000 (16:39 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 21 Aug 2020 16:55:58 +0000 (18:55 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/os/bluestore/BlueFS.cc

index 44652367cfa1078f00b2bda1f7f1cbec2ca0ddc1..eea2e1ac5823505993425d06420f1affbd1d8223 100644 (file)
@@ -2753,13 +2753,11 @@ ceph::bufferlist BlueFS::FileWriter::flush_buffer(
 {
   ceph::bufferlist bl;
   if (partial) {
-    bl.claim_append_piecewise(tail_block);
+    tail_block.splice(0, tail_block.length(), &bl);
   }
-  if (length == bl.length() + buffer.length()) {
-    /* in case of inital allocation and need to zero, limited flush is unacceptable */
-    bl.claim_append_piecewise(buffer);
-  } else {
-    buffer.splice(0, length, &bl);
+  const auto remaining_len = length - bl.length();
+  buffer.splice(0, remaining_len, &bl);
+  if (buffer.length()) {
     dout(20) << " leaving 0x" << std::hex << buffer.length() << std::dec
              << " unflushed" << dendl;
   }