]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueFS: use iterator_impl::copy instead of bufferlist::c_str() to avoid... 39884/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:33:02 +0000 (11:33 +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 octopus but is
otherwise identical

src/os/bluestore/BlueFS.cc

index 871cd0e55e4ccd2c98c29ac88a9bc2e0a3e56fa1..f984a7318ea08ab4dac6f9055d7194a6e2ad0df6 100644 (file)
@@ -1946,8 +1946,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;
       }
 
@@ -2059,8 +2060,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;
     }