From mboxrd@z Thu Jan 1 00:00:00 1970 References: <5D4A7952.4010707@huawei.com> <20190807092142.GB13267@stefanha-x1.localdomain> From: piaojun Message-ID: <5D4AA0D7.9050000@huawei.com> Date: Wed, 7 Aug 2019 17:58:47 +0800 MIME-Version: 1.0 In-Reply-To: <20190807092142.GB13267@stefanha-x1.localdomain> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Virtio-fs] [PATCH v2 2/2][RFC] use fuse_buf_writev to replace fuse_buf_write for better performance List-Id: Development discussions about virtio-fs List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: virtio-fs@redhat.com Hi Stefan, On 2019/8/7 17:21, Stefan Hajnoczi wrote: > On Wed, Aug 07, 2019 at 03:10:10PM +0800, piaojun wrote: >> fuse_buf_writev() only handles the normal write in which src is buffer >> and dest is fd. Specially if src buffer represents guest physical >> address that can't be mapped by the daemon process, IO must be bounced >> back to the VMM to do it by fuse_buf_copy(). >> >> Signed-off-by: Jun Piao >> Suggested-by: Dr. David Alan Gilbert >> --- >> contrib/virtiofsd/passthrough_ll.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c >> index cc9c175..c1bbc53 100644 >> --- a/contrib/virtiofsd/passthrough_ll.c >> +++ b/contrib/virtiofsd/passthrough_ll.c >> @@ -2023,7 +2023,10 @@ static void lo_write_buf(fuse_req_t req, fuse_ino_t ino, >> fuse_debug("lo_write_buf(ino=%" PRIu64 ", size=%zd, off=%lu)\n", >> ino, out_buf.buf[0].size, (unsigned long) off); >> >> - res = fuse_buf_copy(req, &out_buf, in_buf, 0); >> + if (!(in_buf->buf[0].flags & FUSE_BUF_PHYS_ADDR)) >> + res = fuse_buf_writev(req, &out_buf, in_buf, out_buf.buf[0].flags); >> + else >> + res = fuse_buf_copy(req, &out_buf, in_buf, 0); > > Can you move the check inside fuse_buf_copy() and make fuse_buf_writev() > a static function? This way all fuse_buf_copy() callers automatically > benefit from the improvement (when possible). Good suggestion. I will try it in patch v3, and I'm also waiting other developers's comments. > > By the way, this improvement can be sent upstream to libfuse so that > other FUSE file systems also get improved performance. Yes, I need some time looking into libfuse code and sync the fix. Thanks, Jun > > Stefan > . >