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

src/os/bluestore/BlueFS.cc

index 8081b42e12bd587f0ca8b251470aab7b3d5a4581..f71e04da64cbc4f8a79aba44cd3aecfeffa603bf 100644 (file)
@@ -1772,8 +1772,9 @@ int64_t BlueFS::_read_random(
              << " 0x" << off << "~" << len << std::dec
              << dendl;
 
-      // 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;
 
       dout(30) << __func__ << " result chunk (0x"
@@ -1885,8 +1886,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;
     }