diff options
author | Fam Zheng | 2016-01-13 09:37:41 +0100 |
---|---|---|
committer | Kevin Wolf | 2016-01-20 13:36:23 +0100 |
commit | 25ad8e6e95770d4f01844dc2542d861e73b174b2 (patch) | |
tree | c7e471d5a4e33bca28c54353f5317afe6accd9fa /qemu-io-cmds.c | |
parent | block/raw-posix: avoid bogus fixup for cylinders on DASD disks (diff) | |
download | qemu-25ad8e6e95770d4f01844dc2542d861e73b174b2.tar.gz qemu-25ad8e6e95770d4f01844dc2542d861e73b174b2.tar.xz qemu-25ad8e6e95770d4f01844dc2542d861e73b174b2.zip |
qemu-img: Speed up comparing empty/zero images
Two empty raw files are always compared by actually reading data even if
there is no data, because BDRV_BLOCK_ZERO is considered "allocated" in
bdrv_is_allocated_above(). That is inefficient.
Use bdrv_get_block_status_above() for more information, and skip the
consecutive zero sectors.
This brings a huge speed up in comparing sparse/empty raw images:
$ qemu-img create a 1G
$ time ~/build/master/bin/qemu-img compare a a
Images are identical.
real 0m6.583s
user 0m0.191s
sys 0m6.367s
$ time qemu-img compare a a
Images are identical.
real 0m0.033s
user 0m0.003s
sys 0m0.031s
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-io-cmds.c')
0 files changed, 0 insertions, 0 deletions