Skip to content

Enable qemu block layer to not flush

Alexander Graf qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 38 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Add no-op aio emulation stubblock.c block.h+23 -02 replies
2/2Add flush=off parameter to -driveblock/raw-posix.c qemu-config.c qemu-options.hx +1 more+22 -028 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/2] Enable qemu block layer to not flush

Thanks to recent improvements, qemu flushes guest data to disk when the guest tells us to do so.

This is great if we care about data consistency on host disk failures. In cases where we don't it just creates additional overhead for no net win. One such use case is the building of appliances in SUSE Studio. We write the resulting images out of the build VM, but compress it directly afterwards. So if possible we'd love to keep it in RAM.

This patchset introduces a new block parameter to -drive called "flush" which allows a user to disable flushing in odd scenarios like the above. To show the difference in performance this makes, I have put together a small test case. Inside the initrd, I call the following piece of code on a 500MB preallocated vmdk image:

mkfs.ext3 /dev/vda
mkdir -p /mnt
mount /dev/vda /mnt
dd if=/dev/zero of=/mnt/test bs=1M
umount /mnt
sync
halt -fp

With flush=on (default)

real 0m33.597s
user 0m16.453s
sys 0m6.192s

With flush=off

real 0m27.150s
user 0m16.533s
sys 0m5.348s

Alexander Graf (2):
Add no-op aio emulation stub
Add flush=off parameter to -drive

 block.c           |   18 ++++++++++++++++++
 block.h           |    5 +++++
 block/raw-posix.c |   13 +++++++++++++
 qemu-config.c     |    3 +++
 qemu-options.hx   |    3 +++
 vl.c              |    3 +++
 6 files changed, 45 insertions(+), 0 deletions(-)