Skip to content

virtiofsd: Improve io bandwidth by replacing pwrite with pwritev

piaojun virtio-fs 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest2 patches 1 replyIn review
  2. v52 patches 0 repliesSuperseded
  3. v42 patches 14 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v32 patches4 repliesSuperseded
v2 RFC2 patches10 repliesSuperseded
v1 RFC1 patch2 repliesSuperseded

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2virtiofsd: add definition of fuse_buf_writev()contrib/virtiofsd/buffer.c contrib/virtiofsd/seccomp.c+37 -00 replies
2/2virtiofsd: use fuse_buf_writev to replace fuse_buf_write for better performancecontrib/virtiofsd/buffer.c+16 -11 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchDr. David Alan Gilbert
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [Virtio-fs] [PATCH v6 0/2] virtiofsd: Improve io bandwidth by replacing pwrite with pwritev
Quoted 1 line

From my test, write bandwidth will be improved greatly by replacing

pwrite with pwritev, and the test result as below:

---
pwrite:

# fio -direct=1 -time_based -iodepth=64 -rw=randwrite -ioengine=libaio -bs=1M -size=1G -numjob=16 -runtime=30 -group_reporting -name=file -filename=/mnt/virtiofs/file
file: (g=0): rw=randwrite, bs=1M-1M/1M-1M/1M-1M, ioengine=libaio, iodepth=64
...
fio-2.13
Starting 16 processes
Jobs: 16 (f=16): [w(16)] [100.0% done] [0KB/886.0MB/0KB /s] [0/886/0 iops] [eta 00m:00s]
file: (groupid=0, jobs=16): err= 0: pid=5799: Tue Aug 6 18:48:26 2019
write: io=26881MB, bw=916988KB/s, iops=895, runt= 30018msec

pwritev:

# fio -direct=1 -time_based -iodepth=64 -rw=randwrite -ioengine=libaio -bs=1M -size=1G -numjob=16 -runtime=30 -group_reporting -name=file -filename=/mnt/virtiofs/file
file: (g=0): rw=randwrite, bs=1M-1M/1M-1M/1M-1M, ioengine=libaio, iodepth=64
...
fio-2.13
Starting 16 processes
Jobs: 16 (f=16): [w(16)] [100.0% done] [0KB/1793MB/0KB /s] [0/1793/0 iops] [eta 00m:00s]
file: (groupid=0, jobs=16): err= 0: pid=6328: Tue Aug 6 18:22:17 2019
write: io=52775MB, bw=1758.7MB/s, iops=1758, runt= 30009msec
---

This patch introduces writev and pwritev for lo_write_buf().

v2
- Split into two patches
- Add the lost flags support, such as FUSE_BUF_PHYS_ADDR

v3
- use git send-email to make the patch set in one thread
- move fuse_buf_writev() into fuse_buf_copy()
- use writev for the src buffers when they're alread already mapped by the daemon process
- use calloc to replace malloc
- set res 0 if writev() returns 0

v4
- iterate from in_buf->buf[0] rather than buf[1]
- optimize the code to make it more elegant

v5
- add some check for preconditions of the buffers

v6
- add more preconditions before fuse_buf_writev() to make it generic
- skip the empty bufs to avoid writev failed in direct io mode

Jun Piao (2):
add definition of fuse_buf_writev().
use fuse_buf_writev to replace fuse_buf_write for better performance

---
 buffer.c  |   52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 seccomp.c |    2 ++
 2 files changed, 53 insertions(+), 1 deletion(-)

--