Skip to content

Enable qemu block layer to not flush v2

Alexander Graf qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

v1 -> v2 from the cover letter

- clean up no_op patch
- move to cache=volatile instead of flush=off
- make code less intrusive by catching everything in block.c

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Add no-op aio emulation stubblock.c+18 -01 reply
2/2Add cache=volatile parameter to -driveblock.c block.h qemu-config.c +2 more+19 -40 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 v2

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 cache option to -drive called "volatile" which allows a user to signal qemu that he doesn't care about data integrity. 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 cache=writeback

real 0m34.653s
user 0m16.957s
sys 0m5.872s

With cache=volatile

real 0m27.068s
user 0m15.829s
sys 0m6.648s

When I use a loopback file with msdos format and put the vmdk inside there, performance for cache=writeback and cache=volatile is basically identical.

It nevertheless does make sense to offer a cache=volatile option to the user, as it's not always possible to loopback mount your own file systems, especially given qemu's non-root nature.

v1 -> v2:

- clean up no_op patch
- move to cache=volatile instead of flush=off
- make code less intrusive by catching everything in block.c

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

 block.c         |   28 ++++++++++++++++++++++++++++
 block.h         |    1 +
 qemu-config.c   |    2 +-
 qemu-options.hx |    7 ++++---
 vl.c            |    3 +++
 5 files changed, 37 insertions(+), 4 deletions(-)