migration/block: use blk_pwrite_zeroes for each zero cluster
commit3928d50bf151d2f25fde93432b0ee1d8eddd982d
authorLidong Chen <lidongchen@tencent.com>
Thu, 13 Apr 2017 02:34:28 +0000 (13 10:34 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 21 Apr 2017 09:36:12 +0000 (21 10:36 +0100)
treee0cd11b557ef32e5edc082429cd1d8db91308fba
parentd72915c60bff51495529449750e051d01b03c62f
migration/block: use blk_pwrite_zeroes for each zero cluster

BLOCK_SIZE is (1 << 20), qcow2 cluster size is 65536 by default,
this may cause the qcow2 file size to be bigger after migration.
This patch checks each cluster, using blk_pwrite_zeroes for each
zero cluster.

[Initialize cluster_size to BLOCK_SIZE to prevent a gcc uninitialized
variable compiler warning.  In reality we always initialize cluster_size
in a conditional but gcc doesn't know that.
--Stefan]

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Lidong Chen <lidongchen@tencent.com>
Message-id: 1492050868-16200-1-git-send-email-lidongchen@tencent.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
migration/block.c