qemu/block
Alberto Garcia 1221fe6f63 qcow2: Allow configuring the L2 slice size
Now that the code is ready to handle L2 slices we can finally add an
option to allow configuring their size.

An L2 slice is the portion of an L2 table that is read by the qcow2
cache. Until now the cache was always reading full L2 tables, and
since the L2 table size is equal to the cluster size this was not very
efficient with large clusters. Here's a more detailed explanation of
why it makes sense to have smaller cache entries in order to load L2
data:

   https://lists.gnu.org/archive/html/qemu-block/2017-09/msg00635.html

This patch introduces a new command-line option to the qcow2 driver
named l2-cache-entry-size (cf. l2-cache-size). The cache entry size
has the same restrictions as the cluster size: it must be a power of
two and it has the same range of allowed values, with the additional
requirement that it must not be larger than the cluster size.

The L2 cache entry size (L2 slice size) remains equal to the cluster
size for now by default, so this feature must be explicitly enabled.
Although my tests show that 4KB slices consistently improve
performance and give the best results, let's wait and make more tests
with different cluster sizes before deciding on an optimal default.

Now that the cache entry size is not necessarily equal to the cluster
size we need to reflect that in the MIN_L2_CACHE_SIZE documentation.
That minimum value is a requirement of the COW algorithm: we need to
read two L2 slices (and not two L2 tables) in order to do COW, see
l2_allocate() for the actual code.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: c73e5611ff4a9ec5d20de68a6c289553a13d2354.1517840877.git.berto@igalia.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
2018-02-13 17:00:00 +01:00
..
accounting.c block: make accounting thread-safe 2017-06-16 07:55:00 +08:00
backup.c backup: use copy_bitmap in incremental backup 2017-12-18 10:54:13 -05:00
blkdebug.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
blkreplay.c block: change variable names in BlockDriverState 2017-06-26 14:54:46 +02:00
blkverify.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
block-backend.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
bochs.c block: Deprecate bdrv_set_read_only() and users 2017-11-17 13:35:59 +01:00
cloop.c block: Deprecate bdrv_set_read_only() and users 2017-11-17 13:35:59 +01:00
commit.c commit: Simplify reopen of base 2017-12-22 15:05:32 +01:00
crypto.c block: Simplify bdrv_can_write_zeroes_with_unmap() 2018-02-09 12:32:44 -06:00
crypto.h qcow: convert QCow to use QCryptoBlock for encryption 2017-07-11 17:44:56 +02:00
curl.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
dirty-bitmap.c block: maintain persistent disabled bitmaps 2018-02-13 16:59:58 +01:00
dmg-bz2.c dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
dmg.c block: Deprecate bdrv_set_read_only() and users 2017-11-17 13:35:59 +01:00
dmg.h block: remove "qemu/osdep.h" from header file 2017-12-18 17:07:02 +03:00
file-posix.c block: Simplify bdrv_can_write_zeroes_with_unmap() 2018-02-09 12:32:44 -06:00
file-win32.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
gluster.c gluster: Add preallocated truncation 2018-02-13 16:18:35 +01:00
io.c block: Introduce buf register API 2018-02-08 09:22:03 +08:00
iscsi-opts.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
iscsi.c block: Simplify bdrv_can_write_zeroes_with_unmap() 2018-02-09 12:32:44 -06:00
linux-aio.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
Makefile.objs block: Add VFIO based NVMe driver 2018-02-08 09:22:03 +08:00
mirror.c blockjob: remove clock argument from block_job_sleep_ns 2017-11-29 15:11:02 +01:00
nbd-client.c nbd: Don't crash when server reports NBD_CMD_READ failure 2017-11-17 08:02:45 -06:00
nbd-client.h nbd: Minimal structured read for client 2017-10-30 21:48:41 +01:00
nbd.c block: Simplify bdrv_can_write_zeroes_with_unmap() 2018-02-09 12:32:44 -06:00
nfs.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
null.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
nvme.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
parallels.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
parallels.h Clean up includes 2018-02-09 05:05:11 +01:00
qapi.c Include qapi/qmp/qdict.h exactly where needed 2018-02-09 13:52:15 +01:00
qcow2-bitmap.c block: maintain persistent disabled bitmaps 2018-02-13 16:59:58 +01:00
qcow2-cache.c qcow2: Allow configuring the L2 slice size 2018-02-13 17:00:00 +01:00
qcow2-cluster.c qcow2: Rename l2_table in count_cow_clusters() 2018-02-13 17:00:00 +01:00
qcow2-refcount.c qcow2: Update qcow2_update_snapshot_refcount() to support L2 slices 2018-02-13 17:00:00 +01:00
qcow2-snapshot.c qcow2: Discard/zero clusters by byte count 2017-05-11 14:28:07 +02:00
qcow2.c qcow2: Allow configuring the L2 slice size 2018-02-13 17:00:00 +01:00
qcow2.h qcow2: Allow configuring the L2 slice size 2018-02-13 17:00:00 +01:00
qcow.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
qed-check.c qed: Use DIV_ROUND_UP 2016-06-07 18:19:24 +03:00
qed-cluster.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-l2-cache.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-table.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed.c block: Simplify bdrv_can_write_zeroes_with_unmap() 2018-02-09 12:32:44 -06:00
qed.h qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
quorum.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
raw-format.c block: remove unused bdrv_media_changed 2017-09-04 18:31:13 +02:00
rbd.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
replication.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
sheepdog.c sheepdog: Allow fully preallocated truncation 2018-02-13 16:18:41 +01:00
snapshot.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
ssh.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
stream.c blockjob: remove clock argument from block_job_sleep_ns 2017-11-29 15:11:02 +01:00
throttle-groups.c throttle-groups: forget timer and schedule next TGM on detach 2017-11-16 14:12:57 +00:00
throttle.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
trace-events block: Add VFIO based NVMe driver 2018-02-08 09:22:03 +08:00
vdi.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
vhdx-endian.c vhdx: Use QEMU UUID API 2016-09-23 11:42:52 +08:00
vhdx-log.c vhdx: use QEMU_ALIGN_DOWN 2017-08-31 12:29:07 +02:00
vhdx.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
vhdx.h
vmdk.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
vpc.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
vvfat.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
vxhs.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
win32-aio.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
write-threshold.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00