Skip to content

Improve qcow2 performance when used with cache=off.

[email protected] qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 7 repliesIn review
  2. v25 patches 23 repliesSuperseded
  3. v11 patch 5 repliesSuperseded

Changelog from the cover letter

v2: follow the advice of Avi kivity, and modify get_cluster_offset()
v3: follow comments from Kevin Wolf, and add some comments, remove
free_used_clusters().
follow comments from Anthony Liguori, and make more tests, correct a SEGV with encrypted disk (too small buffer), and a file corruption on commit.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5Extract code from get_cluster_offset()block-qcow2.c+154 -621 reply
2/5Divide get_cluster_offset()block-qcow2.c+132 -761 reply
3/5Extract compressing part from alloc_cluster_offset()block-qcow2.c+128 -491 reply
4/5Aggregate same type clusters.block-qcow2.c+182 -543 replies
5/5Try to aggregate free clusters and freed clustersblock-qcow2.c+36 -181 reply

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by.

PatchKevin Wolf
1/5
2/5
3/5A-b
4/5
5/5A-b

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

Read the v3 thread

Cover letter [Qemu-devel] [patch 0/5][v3] Improve qcow2 performance when used with cache=off.

These patches improve qcow2 performance when used with cache=off.

They modify block-qcow2.c to read/write as many clusters as possible per bdrv_aio_[read|write]().

These patches have been tested several hours, with normal disk, encrypted disk, compressed disk and with backing file or not.
Tests were done with mkfs, untar of kernel source, build of kernel sources, rm of all files, dbench 1, dbench 16 and dd to fill the disk (500 MB). fsck is used every time to check filesystem consistency.

Some benchmarks (from [v2]):

* mkfs on 500 MB qcow2 disk

mkfs WITHOUT WITH

ide, cache=off,snapshot=off     41 s            5 s     8x faster
ide, cache=off,snapshot=on      40 s            5 s     8x faster
ide, cache=on, snapshot=off      3 s            3 s
ide, cache=on, snapshot=on       4 s            3 s

* tar jxvf linux-2.6.25.7.tar.bz2

ide, cache=off,snapshot=off     847 s           379 s   2.2x faster
ide, cache=off,snapshot=on      801 s           364 s   2.2x faster
ide, cache=on, snapshot=off     238 s           236 s
ide, cache=on, snapshot=on      236 s           237 s

* dd if=/dev/zero of=file

dd if=/dev/null WITHOUT WITH

ide, cache=off,snapshot=off     333 kB/s        3.7 MB/s  11.3x faster
ide, cache=off,snapshot=on      337 kB/s        3.6 MB/s  10.9x faster
ide, cache=on, snapshot=off    9.06 MB/s        9.23 MB/s
ide, cache=on, snapshot=on     8,89 MB/s        8.89 MB/s

* dbench 1

dbench WITHOUT WITH

ide, cache=off,snapshot=off     20.8494 MB/sec  24.8521 MB/sec          +19,2%
ide, cache=off,snapshot=on      20.9349 MB/sec  24.2296 MB/sec          +15,7%
ide, cache=on, snapshot=off     23.6612 MB/sec  25.4724 MB/sec          + 7,6%
ide, cache=on, snapshot=on      24.1836 MB/sec  24.8169 MB/sec

Changelog:
v2: follow the advice of Avi kivity, and modify get_cluster_offset()
v3: follow comments from Kevin Wolf, and add some comments, remove
free_used_clusters().
follow comments from Anthony Liguori, and make more tests, correct a SEGV with encrypted disk (too small buffer), and a file corruption on commit.

[PATCH 1/5] extract code from get_cluster_offset() into new functions

            seek_l2_table(), l2_load() and l2_allocate().

[PATCH 2/5] divide get_cluster_offset() into get_cluster_offset() and
alloc_cluster_offset().

[PATCH 3/5] divide alloc_cluster_offset() into alloc_cluster_offset()
and alloc_compressed_cluster_offset().

[PATCH 4/5] modify get_cluster_offset(), alloc_cluster_offset() to specify
how many clusters we want.

[PATCH 5/5] in alloc_cluster_offset(), try to aggregate free clusters
and freed clusters.
--