qcow2: Add subcluster support to handle_alloc_space()
commitbf4a66eed423694cfa0b3b5692211264022e2b98
authorAlberto Garcia <berto@igalia.com>
Fri, 10 Jul 2020 16:13:09 +0000 (10 18:13 +0200)
committerMax Reitz <mreitz@redhat.com>
Tue, 25 Aug 2020 06:33:20 +0000 (25 08:33 +0200)
tree9691b8749033c05a81f784595c96d8c0ab1bc869
parentff4cdec7f6e7302d2a82fdb627373c32aecb3dfe
qcow2: Add subcluster support to handle_alloc_space()

The bdrv_co_pwrite_zeroes() call here fills complete clusters with
zeroes, but it can happen that some subclusters are not part of the
write request or the copy-on-write. This patch makes sure that only
the affected subclusters are overwritten.

A potential improvement would be to also fill with zeroes the other
subclusters if we can guarantee that we are not overwriting existing
data. However this would waste more disk space, so we should first
evaluate if it's really worth doing.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <b3dc97e8e2240ddb5191a4f930e8fc9653f94621.1594396418.git.berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qcow2.c