]> git.proxmox.com Git - mirror_qemu.git/commit - block/qcow2.c
qcow2: Avoid COW during metadata preallocation
authorKevin Wolf <kwolf@redhat.com>
Mon, 15 Apr 2019 14:25:01 +0000 (16:25 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 30 Apr 2019 13:29:00 +0000 (15:29 +0200)
commitf29fbf7c6b1c9a84f6931c1c222716fbe073e6e4
tree10fec182079ffb17a7acdcdaf91a9c5d2b8ba01f
parentde38b5005e946aa3714963ea4c501e279e7d3666
qcow2: Avoid COW during metadata preallocation

Limiting the allocation to INT_MAX bytes isn't particularly clever
because it means that the final cluster will be a partial cluster which
will be completed through a COW operation. This results in unnecessary
data read and write requests which lead to an unwanted non-sparse
filesystem block for metadata preallocation.

Align the maximum allocation size down to the cluster size to avoid this
situation.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
block/qcow2.c