diff options
author | Kevin Wolf <kwolf@redhat.com> | 2020-04-30 15:30:05 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2020-05-08 13:26:35 +0200 |
commit | 78cae78dbcf94a151203ab5c6e418d9d9094a59e (patch) | |
tree | 712dc2a5ef3961a1dc75f74a387cc4190efecea9 /block | |
parent | 4823cde58eb507fcdcc0225b087343439a6cb43c (diff) |
vmdk: Don't update L2 table for zero write on zero cluster
If a cluster is already zeroed, we don't have to call vmdk_L2update(),
which is rather slow because it flushes the image file.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200430133007.170335-5-kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/vmdk.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/block/vmdk.c b/block/vmdk.c index ab8eec1f27..2880d88dea 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2013,7 +2013,7 @@ static int vmdk_pwritev(BlockDriverState *bs, uint64_t offset, offset_in_cluster == 0 && n_bytes >= extent->cluster_sectors * BDRV_SECTOR_SIZE) { n_bytes = extent->cluster_sectors * BDRV_SECTOR_SIZE; - if (!zero_dry_run) { + if (!zero_dry_run && ret != VMDK_ZEROED) { /* update L2 tables */ if (vmdk_L2update(extent, &m_data, VMDK_GTE_ZEROED) != VMDK_OK) { |