]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueFS: use iterator_impl::copy instead of bufferlist::c_str() to avoid... 39883/head
authorweixinwei <xinweiwei90@gmail.com>
Thu, 11 Feb 2021 02:31:11 +0000 (10:31 +0800)
committersinguliere <singuliere@autistici.org>
Sat, 6 Mar 2021 10:26:47 +0000 (11:26 +0100)
Signed-off-by: weixinwei <xinweiwei90@gmail.com>
(cherry picked from commit 8baa6ce567064a13b27e20b1a755bb2e5e871ebd)

 Conflicts:
src/os/bluestore/BlueFS.cc
        the line is wrapped in "if (out) {}" in nautilus but is
otherwise identical

src/os/bluestore/BlueFS.cc

index f7bda939ae4cef9299bb3a5e96cc42a59015852a..444138c753943cf6ab4a6a669e1278db133f5df6 100644 (file)
@@ -1745,8 +1745,9 @@ int64_t BlueFS::_read_random(
              << dendl;
 
       if (out) {
-       // NOTE: h->bl is normally a contiguous buffer so c_str() is free.
-       memcpy(out, buf->bl.c_str() + off - buf->bl_off, r);
+       auto p = buf->bl.begin();
+       p.seek(off - buf->bl_off);
+       p.copy(r, out);
        out += r;
       }
 
@@ -1864,8 +1865,9 @@ int64_t BlueFS::_read(
       outbl->claim_append(t);
     }
     if (out) {
-      // NOTE: h->bl is normally a contiguous buffer so c_str() is free.
-      memcpy(out, buf->bl.c_str() + off - buf->bl_off, r);
+      auto p = buf->bl.begin();
+      p.seek(off - buf->bl_off);
+      p.copy(r, out);
       out += r;
     }