qcow2: skip writing zero buffers to empty COW areas

If COW areas of the newly allocated clusters are zeroes on the backing
image, efficient bdrv_write_zeroes(flags=BDRV_REQ_NO_FALLBACK) can be
used on the whole cluster instead of writing explicit zero buffers later
in perform_cow().

iotest 060:
write to the discarded cluster does not trigger COW anymore.
Use a backing image instead.

Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
Message-id: 20190516142749.81019-2-anton.nefedov@virtuozzo.com
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Anton Nefedov 2019-05-16 17:27:49 +03:00 committed by Max Reitz
parent 330c729571
commit c8bb23cbdb
7 changed files with 106 additions and 4 deletions

View file

@ -405,6 +405,12 @@ typedef struct QCowL2Meta
*/
Qcow2COWRegion cow_end;
/*
* Indicates that COW regions are already handled and do not require
* any more processing.
*/
bool skip_cow;
/**
* The I/O vector with the data from the actual guest write request.
* If non-NULL, this is meant to be merged together with the data