]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-fuse: switch to fuse_reply_iov to reduce the memory copy
authorXiubo Li <xiubli@redhat.com>
Tue, 28 Apr 2020 04:55:29 +0000 (00:55 -0400)
committerXiubo Li <xiubli@redhat.com>
Wed, 8 Jul 2020 07:27:05 +0000 (03:27 -0400)
Fixes: https://tracker.ceph.com/issues/45267
Signed-off-by: Xiubo Li <xiubli@redhat.com>
src/client/fuse_ll.cc

index 3b2118bdcdde32a72e1c129f506e8f5247af6b1e..16f4d12abd0d518e6b30b15bac5ffd324b2240ba 100644 (file)
@@ -612,9 +612,12 @@ static void fuse_ll_read(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
   Fh *fh = reinterpret_cast<Fh*>(fi->fh);
   bufferlist bl;
   int r = cfuse->client->ll_read(fh, off, size, &bl);
-  if (r >= 0)
-    fuse_reply_buf(req, bl.c_str(), bl.length());
-  else
+  if (r >= 0) {
+    vector<iovec> iov;
+    bl.prepare_iov(&iov);
+    iov.insert(iov.begin(), {0}); // the first one is reserved for fuse_out_header
+    fuse_reply_iov(req, &iov[0], iov.size());
+  } else
     fuse_reply_err(req, -r);
 }