]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
misc: using move construct to avoid extra atomic inc/dec
authorHaomai Wang <haomai@xsky.com>
Mon, 1 Feb 2016 05:55:52 +0000 (13:55 +0800)
committerHaomai Wang <haomai@xsky.com>
Tue, 2 Feb 2016 18:36:44 +0000 (02:36 +0800)
Signed-off-by: Haomai Wang <haomai@xsky.com>
21 files changed:
src/common/SloppyCRCMap.h
src/erasure-code/ErasureCode.cc
src/librbd/librbd.cc
src/msg/async/AsyncConnection.cc
src/msg/simple/Pipe.cc
src/os/FuseStore.cc
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueStore.cc
src/os/bluestore/KernelDevice.cc
src/os/bluestore/NVMEDevice.cc
src/os/filestore/FileJournal.cc
src/os/filestore/FileStore.cc
src/os/filestore/GenericFileStoreBackend.cc
src/os/fs/FS.cc
src/os/fs/FS.h
src/os/kstore/KStore.cc
src/os/memstore/MemStore.cc
src/osd/OSD.cc
src/osd/PGBackend.cc
src/osdc/ObjectCacher.cc
src/osdc/Striper.cc

index c07b4d9bb9d43d1336f16f2fb32582584add624e..34642a325394d4853a55006b383dc41123fd8955 100644 (file)
@@ -34,9 +34,7 @@ public:
     //zero_crc = ceph_crc32c(0xffffffff, NULL, block_size);
     if (b) {
       bufferlist bl;
-      bufferptr bp(block_size);
-      bp.zero();
-      bl.append(bp);
+      bl.append_zero(block_size);
       zero_crc = bl.crc32c(crc_iv);
     } else {
       zero_crc = crc_iv;
index 6d83d44385fe77f093b601af1a9d41997987d391..eaacb246932c0158469bb7030faf2a9023045658 100644 (file)
@@ -93,12 +93,12 @@ int ErasureCode::encode_prepare(const bufferlist &raw,
 
     raw.copy((k - padded_chunks) * blocksize, remainder, buf.c_str());
     buf.zero(remainder, blocksize - remainder);
-    encoded[chunk_index(k-padded_chunks)].push_back(buf);
+    encoded[chunk_index(k-padded_chunks)].push_back(std::move(buf));
 
     for (unsigned int i = k - padded_chunks + 1; i < k; i++) {
       bufferptr buf(buffer::create_aligned(blocksize, SIMD_ALIGN));
       buf.zero();
-      encoded[chunk_index(i)].push_back(buf);
+      encoded[chunk_index(i)].push_back(std::move(buf));
     }
   }
   for (unsigned int i = k; i < k + m; i++) {
index 0b76ebae052447db67566ab6aed839ed1d007f3a..4a47ab25760aae9615de99637f43b910b35a5a07 100644 (file)
@@ -968,7 +968,7 @@ namespace librbd {
     ImageCtx *ictx = (ImageCtx *)ctx;
     tracepoint(librbd, read_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(), ictx->read_only, ofs, len);
     bufferptr ptr(len);
-    bl.push_back(ptr);
+    bl.push_back(std::move(ptr));
     int r = ictx->aio_work_queue->read(ofs, len, bl.c_str(), 0);
     tracepoint(librbd, read_exit, r);
     return r;
@@ -980,7 +980,7 @@ namespace librbd {
     tracepoint(librbd, read2_enter, ictx, ictx->name.c_str(), ictx->snap_name.c_str(),
                ictx->read_only, ofs, len, op_flags);
     bufferptr ptr(len);
-    bl.push_back(ptr);
+    bl.push_back(std::move(ptr));
     int r = ictx->aio_work_queue->read(ofs, len, bl.c_str(), op_flags);
     tracepoint(librbd, read_exit, r);
     return r;
index 89caaa23a7e978f690abfef00bfa804afa2ccf7e..654467a3aa07b9f4dfe08c692ec370145008dc7b 100644 (file)
@@ -161,19 +161,16 @@ static void alloc_aligned_buffer(bufferlist& data, unsigned len, unsigned off)
     // head
     unsigned head = 0;
     head = MIN(CEPH_PAGE_SIZE - (off & ~CEPH_PAGE_MASK), left);
-    bufferptr bp = buffer::create(head);
-    data.push_back(bp);
+    data.push_back(buffer::create(head));
     left -= head;
   }
   unsigned middle = left & CEPH_PAGE_MASK;
   if (middle > 0) {
-    bufferptr bp = buffer::create_page_aligned(middle);
-    data.push_back(bp);
+    data.push_back(buffer::create_page_aligned(middle));
     left -= middle;
   }
   if (left) {
-    bufferptr bp = buffer::create(left);
-    data.push_back(bp);
+    data.push_back(buffer::create(left));
   }
 }
 
@@ -727,10 +724,9 @@ void AsyncConnection::process()
           // read front
           unsigned front_len = current_header.front_len;
           if (front_len) {
-            if (!front.length()) {
-              bufferptr ptr = buffer::create(front_len);
-              front.push_back(ptr);
-            }
+            if (!front.length())
+              front.push_back(buffer::create(front_len));
+
             r = read_until(front_len, front.c_str());
             if (r < 0) {
               ldout(async_msgr->cct, 1) << __func__ << " read message front failed" << dendl;
@@ -750,10 +746,9 @@ void AsyncConnection::process()
           // read middle
           unsigned middle_len = current_header.middle_len;
           if (middle_len) {
-            if (!middle.length()) {
-              bufferptr ptr = buffer::create(middle_len);
-              middle.push_back(ptr);
-            }
+            if (!middle.length())
+              middle.push_back(buffer::create(middle_len));
+
             r = read_until(middle_len, middle.c_str());
             if (r < 0) {
               ldout(async_msgr->cct, 1) << __func__ << " read message middle failed" << dendl;
index 89c8b8f24cd2ef669b39a03b522f040a16a6e7a6..9fc3431588f6ea5c7f02250f4ab5d5cf4cef8666 100644 (file)
@@ -333,7 +333,7 @@ int Pipe::accept()
   }
   {
     bufferptr tp(sizeof(peer_addr));
-    addrbl.push_back(tp);
+    addrbl.push_back(std::move(tp));
   }
   if (tcp_read(addrbl.c_str(), addrbl.length()) < 0) {
     ldout(msgr->cct,10) << "accept couldn't read peer_addr" << dendl;
@@ -371,7 +371,7 @@ int Pipe::accept()
         ldout(msgr->cct,10) << "accept couldn't read connect authorizer" << dendl;
         goto fail_unlocked;
       }
-      authorizer.push_back(bp);
+      authorizer.push_back(std::move(bp));
       authorizer_reply.clear();
     }
 
@@ -948,7 +948,7 @@ int Pipe::connect()
     int wirelen = sizeof(__u32) * 2 + sizeof(ceph_sockaddr_storage);
     bufferptr p(wirelen * 2);
 #endif
-    addrbl.push_back(p);
+    addrbl.push_back(std::move(p));
   }
   if (tcp_read(addrbl.c_str(), addrbl.length()) < 0) {
     ldout(msgr->cct,2) << "connect couldn't read peer addrs, " << cpp_strerror(errno) << dendl;
@@ -1875,19 +1875,16 @@ static void alloc_aligned_buffer(bufferlist& data, unsigned len, unsigned off)
     // head
     unsigned head = 0;
     head = MIN(CEPH_PAGE_SIZE - (off & ~CEPH_PAGE_MASK), left);
-    bufferptr bp = buffer::create(head);
-    data.push_back(bp);
+    data.push_back(buffer::create(head));
     left -= head;
   }
   unsigned middle = left & CEPH_PAGE_MASK;
   if (middle > 0) {
-    bufferptr bp = buffer::create_page_aligned(middle);
-    data.push_back(bp);
+    data.push_back(buffer::create_page_aligned(middle));
     left -= middle;
   }
   if (left) {
-    bufferptr bp = buffer::create(left);
-    data.push_back(bp);
+    data.push_back(buffer::create(left));
   }
 }
 
@@ -1975,7 +1972,7 @@ int Pipe::read_message(Message **pm, AuthSessionHandler* auth_handler)
     bufferptr bp = buffer::create(front_len);
     if (tcp_read(bp.c_str(), front_len) < 0)
       goto out_dethrottle;
-    front.push_back(bp);
+    front.push_back(std::move(bp));
     ldout(msgr->cct,20) << "reader got front " << front.length() << dendl;
   }
 
@@ -1985,7 +1982,7 @@ int Pipe::read_message(Message **pm, AuthSessionHandler* auth_handler)
     bufferptr bp = buffer::create(middle_len);
     if (tcp_read(bp.c_str(), middle_len) < 0)
       goto out_dethrottle;
-    middle.push_back(bp);
+    middle.push_back(std::move(bp));
     ldout(msgr->cct,20) << "reader got middle " << middle.length() << dendl;
   }
 
index 86c028f043ab1611677766ef5d7d07f4cc5f3db4..0849865af69ad156e7555140442540a2af07c06a 100644 (file)
@@ -809,9 +809,7 @@ static int os_write(const char *path, const char *buf, size_t size,
     } else {
       final.claim_append(*pbl);
       size_t zlen = offset - final.length();
-      bufferptr z(zlen);
-      z.zero();
-      final.append(z);
+      final.append_zero(zlen);
     }
   }
   final.append(buf, size);
index dbee7c809ce4e4b044ff2f13b528350af4460334..3c0b13cdabc3c503dcccfe8c0d0ddad973b11c27 100644 (file)
@@ -304,9 +304,7 @@ int BlueFS::_write_super()
   uint32_t crc = bl.crc32c(-1);
   ::encode(crc, bl);
   assert(bl.length() <= get_super_length());
-  bufferptr z(get_super_length() - bl.length());
-  z.zero();
-  bl.append(z);
+  bl.append_zero(get_super_length() - bl.length());
   bl.rebuild();
 
   IOContext ioc(NULL);
@@ -889,12 +887,8 @@ void BlueFS::_pad_bl(bufferlist& bl)
 {
   uint64_t partial = bl.length() % super.block_size;
   if (partial) {
-    bufferptr z(super.block_size - partial);
-    dout(10) << __func__ << " padding with " << z.length() << " zeros" << dendl;
-    z.zero();
-    bufferlist zbl;
-    zbl.append(z);
-    bl.append(z);
+    dout(10) << __func__ << " padding with " << super.block_size - partial << " zeros" << dendl;
+    bl.append_zero(super.block_size - partial);
   }
 }
 
@@ -1038,9 +1032,7 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length)
       dout(20) << __func__ << " caching tail of " << tail
               << " and padding block with zeros" << dendl;
       h->tail_block.substr_of(bl, bl.length() - tail, tail);
-      bufferptr z(super.block_size - tail);
-      z.zero();
-      t.append(z);
+      t.append_zero(super.block_size - tail);
     }
     bdev[p->bdev]->aio_write(p->offset + x_off, t, h->iocv[p->bdev], true);
     bloff += x_len;
index d0a1451ae68adfe2d9e75c411926e0b7d8d4716c..7ff14ff8fc8f4e31600dcd26cd28522ef18f7c09 100644 (file)
@@ -860,7 +860,7 @@ int BlueStore::_write_bdev_label(string path, bluestore_bdev_label_t label)
   assert(bl.length() <= BDEV_LABEL_BLOCK_SIZE);
   bufferptr z(BDEV_LABEL_BLOCK_SIZE - bl.length());
   z.zero();
-  bl.append(z);
+  bl.append(std::move(z));
 
   int fd = ::open(path.c_str(), O_WRONLY);
   if (fd < 0) {
@@ -2597,9 +2597,7 @@ int BlueStore::_do_read(
        // unwritten (zero) extent
        dout(30) << __func__ << " data " << bp->first << ": " << bp->second
                 << ", use " << x_len << " zeros" << dendl;
-       bufferptr bp(x_len);
-       bp.zero();
-       bl.push_back(bp);
+       bl.append_zero(x_len);
       }
       offset += x_len;
       length -= x_len;
@@ -2616,9 +2614,7 @@ int BlueStore::_do_read(
 
     // zero.
     dout(30) << __func__ << " zero " << offset << "~" << x_len << dendl;
-    bufferptr bp(x_len);
-    bp.zero();
-    bl.push_back(bp);
+    bl.append_zero(x_len);
     offset += x_len;
     length -= x_len;
     continue;
@@ -5529,10 +5525,8 @@ int BlueStore::_do_write_zero(
   uint64_t offset,
   uint64_t length)
 {
-  bufferptr z(length);
-  z.zero();
   bufferlist zl;
-  zl.push_back(z);
+  zl.append_zero(length);
   return _do_write(txc, c, o, offset, length, zl, 0);
 }
 
index 9dfa820b148eac20275d5907a2f5bc0df652b057..7f262d72c28b42f963406a16aacd3e3f70459836 100644 (file)
@@ -461,7 +461,7 @@ int KernelDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
     goto out;
   }
   pbl->clear();
-  pbl->push_back(p);
+  pbl->push_back(std::move(p));
 
   dout(40) << "data: ";
   pbl->hexdump(*_dout);
index 9d0eb63a60389528d889bde6900d8ab51acd2935..bd2639b1b9998bab1495959a869336d216db1467 100644 (file)
@@ -829,7 +829,7 @@ int NVMEDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
     dout(10) << __func__ << " read from buffer " << copied << dendl;
   }
   pbl->clear();
-  pbl->push_back(p);
+  pbl->push_back(std::move(p));
   r = t->return_code;
   rte_free(t->buf);
 
index 2b41cf440d190c5ee62a7cd1f3a0517c692eff7c..7763c6f95f4dbc9a6ce2bfe396c1180e3ad9fe37 100644 (file)
@@ -766,7 +766,7 @@ int FileJournal::read_header(header_t *hdr) const
       memset(bpdata, 0, bp.length() - r);
   }
 
-  bl.push_back(bp);
+  bl.push_back(std::move(bp));
 
   try {
     bufferlist::iterator p = bl.begin();
@@ -1885,7 +1885,7 @@ void FileJournal::wrap_read_bl(
           << r << dendl;
       ceph_abort();
     }
-    bl->push_back(bp);
+    bl->push_back(std::move(bp));
     pos += len;
     olen -= len;
   }
index f7f7f5757fd1c791cdcc8f838a7d70f7d97fcf07..1390b02633ec0fc94db0ed1ba36a1a5f49e7f8e3 100644 (file)
@@ -1164,7 +1164,7 @@ int FileStore::read_superblock()
   }
 
   bufferlist bl;
-  bl.push_back(bp);
+  bl.push_back(std::move(bp));
   bufferlist::iterator i = bl.begin();
   ::decode(superblock, i);
   return 0;
@@ -1186,7 +1186,7 @@ int FileStore::version_stamp_is_valid(uint32_t *version)
     return ret;
   }
   bufferlist bl;
-  bl.push_back(bp);
+  bl.push_back(std::move(bp));
   bufferlist::iterator i = bl.begin();
   ::decode(*version, i);
   dout(10) << __func__ << " was " << *version << " vs target "
@@ -2969,7 +2969,7 @@ int FileStore::read(
     return got;
   }
   bptr.set_length(got);   // properly size the buffer
-  bl.push_back(bptr);   // put it in the target bufferlist
+  bl.push_back(std::move(bptr));   // put it in the target bufferlist
 
 #ifdef HAVE_POSIX_FADVISE
   if (op_flags & CEPH_OSD_OP_FLAG_FADVISE_DONTNEED)
@@ -3278,10 +3278,8 @@ int FileStore::_zero(const coll_t& cid, const ghobject_t& oid, uint64_t offset,
   // write zeros.. yuck!
   dout(20) << "zero FALLOC_FL_PUNCH_HOLE not supported, falling back to writing zeros" << dendl;
   {
-    bufferptr bp(len);
-    bp.zero();
     bufferlist bl;
-    bl.push_back(bp);
+    bl.append_zero(len);
     ret = _write(cid, oid, offset, len, bl);
   }
 
@@ -4421,7 +4419,7 @@ int FileStore::collection_getattr(const coll_t& c, const char *name, bufferlist&
     goto out;
   }
   r = _fgetattr(fd, n, bp);
-  bl.push_back(bp);
+  bl.push_back(std::move(bp));
   VOID_TEMP_FAILURE_RETRY(::close(fd));
  out:
   dout(10) << "collection_getattr " << fn << " '" << name << "' = " << r << dendl;
index d62d6221b3f0d906d0b268760865a2f5b7c5818e..d4c2a52ea5ed10c00f0e07e67f6c5c9ad23b67f8 100644 (file)
@@ -344,7 +344,7 @@ int GenericFileStoreBackend::_crc_load_or_init(int fd, SloppyCRCMap *cm)
     }
   }
   bufferlist bl;
-  bl.append(bp);
+  bl.append(std::move(bp));
   bufferlist::iterator p = bl.begin();
   try {
     ::decode(*cm, p);
index b7c7987997cf87ab1e048b2250c830ff6cd0275d..187217087a3e08015ac0bfe270b20385efcf052c 100644 (file)
@@ -170,9 +170,7 @@ int FS::zero(int fd, uint64_t offset, uint64_t length)
   {
     // fall back to writing zeros
     bufferlist bl;
-    bufferptr bp(length);
-    bp.zero();
-    bl.append(bp);
+    bl.append_zero(length);
     r = ::lseek64(fd, offset, SEEK_SET);
     if (r < 0) {
       r = -errno;
index 4b09bcecd70ffc0f192dd6940ced437b1e0abb3c..63cd05f0b6b7f6a1a3f30dc3440571ffd8238d18 100644 (file)
@@ -76,8 +76,8 @@ public:
       offset = _offset;
       length = len;
       bufferptr p = buffer::create_page_aligned(length);
-      bl.append(p);
       io_prep_pread(&iocb, fd, p.c_str(), length, offset);
+      bl.append(std::move(p));
     }
 
     int get_return_value() {
index d3d9b92b257092af07a184cb3c705b41cfcef7d7..0b63ed31c318c4c1b958256a0aa8ff827370921d 100644 (file)
@@ -1541,9 +1541,7 @@ int KStore::_do_read(
     length = o->onode.size - offset;
   }
   if (stripe_size == 0) {
-    bufferptr z(length);
-    z.zero();
-    bl.append(z);
+    bl.append_zero(length);
     r = length;
     goto out;
   }
@@ -1571,17 +1569,13 @@ int KStore::_do_read(
          dout(30) << __func__ << " taking " << stripe_off << "~" << l << dendl;
        }
        if (l < swant) {
-         bufferptr z(swant - l);
-         z.zero();
-         bl.append(z);
-         dout(30) << __func__ << " adding " << z.length() << " zeros" << dendl;
+         bl.append_zero(swant - l);
+         dout(30) << __func__ << " adding " << swant - l << " zeros" << dendl;
        }
       }
     } else {
       dout(30) << __func__ << " generating " << swant << " zeros" << dendl;
-      bufferptr z(swant);
-      z.zero();
-      bl.append(z);
+      bl.append_zero(swant);
     }
     offset += swant;
     length -= swant;
@@ -2945,10 +2939,8 @@ int KStore::_do_write(TransContext *txc,
        bl.substr_of(prev, 0, p);
       }
       if (p < offset_rem) {
-       bufferptr z(offset_rem - p);
-       dout(20) << __func__ << " add leading " << z.length() << " zeros" << dendl;
-       z.zero();
-       bl.append(z);
+       dout(20) << __func__ << " add leading " << offset_rem - p << " zeros" << dendl;
+       bl.append_zero(offset_rem - p);
       }
     }
     unsigned use = stripe_size - offset_rem;
@@ -3039,10 +3031,9 @@ int KStore::_zero(TransContext *txc,
          dout(20) << __func__ << " truncated stripe " << pos - stripe_off
                   << " to " << bl.length() << dendl;
        } else {
-         bufferptr z(end - (pos - stripe_off + bl.length()));
-         z.zero();
-         bl.append(z);
-         dout(20) << __func__ << " adding " << z.length() << " of zeros" << dendl;
+          auto len = end - (pos - stripe_off + bl.length());
+         bl.append_zero(len);
+         dout(20) << __func__ << " adding " << len << " of zeros" << dendl;
          if (stripe.length() > bl.length()) {
            unsigned l = stripe.length() - bl.length();
            bufferlist t;
index 30694c4a3b55cfa472876c4e3a7c4bd8a488687a..cd0cd3610e878018065bc30e3b383607592a3155 100644 (file)
@@ -1030,10 +1030,8 @@ int MemStore::_zero(const coll_t& cid, const ghobject_t& oid,
 {
   dout(10) << __func__ << " " << cid << " " << oid << " " << offset << "~"
           << len << dendl;
-  bufferptr bp(len);
-  bp.zero();
   bufferlist bl;
-  bl.push_back(bp);
+  bl.append_zero(len);
   return _write(cid, oid, offset, len, bl);
 }
 
@@ -1422,9 +1420,7 @@ int MemStore::BufferlistObject::write(uint64_t offset, const bufferlist &src)
     newdata.substr_of(data, 0, offset);
   } else {
     newdata.substr_of(data, 0, get_size());
-    bufferptr bp(offset - get_size());
-    bp.zero();
-    newdata.append(bp);
+    newdata.append(offset - get_size());
   }
 
   newdata.append(src);
@@ -1469,9 +1465,7 @@ int MemStore::BufferlistObject::truncate(uint64_t size)
   } else if (get_size() == size) {
     // do nothing
   } else {
-    bufferptr bp(size - get_size());
-    bp.zero();
-    data.append(bp);
+    data.append_zero(size - get_size());
   }
   return 0;
 }
@@ -1532,7 +1526,7 @@ int MemStore::PageSetObject::read(uint64_t offset, uint64_t len, bufferlist& bl)
 
   tls_pages.clear(); // drop page refs
 
-  bl.append(buf);
+  bl.append(std::move(buf));
   return len;
 }
 
index 7fb5b6fbb1b5c90316343ca166fcd74aa7aaf0b0..9b2f0dcb4e8099af37ec39e274f4f2147a67374b 100644 (file)
@@ -5304,7 +5304,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
       bufferlist bl;
       bufferptr bp(osize);
       bp.zero();
-      bl.push_back(bp);
+      bl.push_back(std::move(bp));
       bl.rebuild_page_aligned();
       for (int i=0; i<onum; ++i) {
        char nm[30];
@@ -5321,7 +5321,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
     bufferlist bl;
     bufferptr bp(bsize);
     bp.zero();
-    bl.push_back(bp);
+    bl.push_back(std::move(bp));
     bl.rebuild_page_aligned();
 
     {
index 13515d70b673fdccfd7f7babe63b78189a52209b..85bd78b708bd45716fdb46c2e22060754ff9762f 100644 (file)
@@ -186,7 +186,7 @@ int PGBackend::objects_get_attr(
     bp);
   if (r >= 0 && out) {
     out->clear();
-    out->push_back(bp);
+    out->push_back(std::move(bp));
   }
   return r;
 }
index acf6004e446d3120db9a7b88c33ae77b737cea40..f7ae589c361101422b0132bcd21f060968df231f 100644 (file)
@@ -724,12 +724,10 @@ void ObjectCacher::bh_read_finish(int64_t poolid, sobject_t oid,
                << dendl;
 
   if (r >= 0 && bl.length() < length) {
-    bufferptr bp(length - bl.length());
-    bp.zero();
     ldout(cct, 7) << "bh_read_finish " << oid << " padding " << start << "~"
-                 << length << " with " << bp.length() << " bytes of zeroes"
+                 << length << " with " << length - bl.length() << " bytes of zeroes"
                  << dendl;
-    bl.push_back(bp);
+    bl.append_zero(length - bl.length());
   }
 
   list<Context*> ls;
@@ -1459,9 +1457,7 @@ int ObjectCacher::_readx(OSDRead *rd, ObjectSet *oset, Context *onfinish,
          // put substr here first, since substr_of clobbers, and we
          // may get multiple bh's at this stripe_map position
          if (bh->is_zero()) {
-           bufferptr bp(len);
-           bp.zero();
-           stripe_map[f_it->first].push_back(bp);
+           stripe_map[f_it->first].append_zero(len);
          } else {
            bit.substr_of(bh->bl,
                opos - bh->start(),
index 9a35ffe82653d293bf658baa415f431bae5a11bc..4395106eceef128e1bcb1d9017ae25c250057783 100644 (file)
@@ -369,9 +369,7 @@ void Striper::StripedReadResult::assemble_result(CephContext *cct,
     size_t len = p->second.first.length();
     if (len < p->second.second) {
       if (zero_tail || bl.length()) {
-       bufferptr bp(p->second.second - len);
-       bp.zero();
-       bl.push_front(bp);
+       bl.append_zero(p->second.second - len);
        bl.claim_prepend(p->second.first);
       } else {
        bl.claim_prepend(p->second.first);