]> git.ipfire.org Git - thirdparty/qemu.git/commit
qcow2: Avoid COW during metadata preallocation
authorKevin Wolf <kwolf@redhat.com>
Mon, 15 Apr 2019 14:25:01 +0000 (16:25 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 9 Jul 2019 17:21:26 +0000 (12:21 -0500)
commitc627cc38be31b352ff83f7837c5419d34b1b295b
treee278a955a91a76925e37f34b5b848916c84df003
parentb443db97c1b60765c5e1495cb0239c5b99d6c930
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>
(cherry picked from commit f29fbf7c6b1c9a84f6931c1c222716fbe073e6e4)
*modified to avoid functional dependency on 93e32b3e
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/qcow2.c