qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 0/2] use blk_pwrite_zeroes for each zero cluster


From: 858585 jemmy
Subject: Re: [Qemu-block] [PATCH 0/2] use blk_pwrite_zeroes for each zero cluster
Date: Fri, 7 Apr 2017 14:55:24 +0800

On Fri, Apr 7, 2017 at 1:22 PM, 858585 jemmy <address@hidden> wrote:
> the test result for this patch:
>
> the migration command :
> virsh migrate --live 165cf436-312f-47e7-90f2-f8aa63f34893
> --copy-storage-all qemu+ssh://10.59.163.38/system
>
> the qemu-img info on source host:
> qemu-img info 
> /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2
> image: 
> /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2
> file format: qcow2
> virtual size: 1.0T (1095216660480 bytes)
> disk size: 1.5G (1638989824 bytes)
> cluster_size: 65536
> backing file: /baseimage/img2016042213665396/img2016042213665396.qcow2
>
> the qemu-img info on dest host(before apply patch):
> qemu-img info 
> /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2
> image: 
> /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2
> file format: qcow2
> virtual size: 40G (42949672960 bytes)
> disk size: 4.1G (4423286784 bytes)
> cluster_size: 65536
> backing file: /baseimage/img2016042213665396/img2016042213665396.qcow2
>
> the qemu-img info on dest host(after apply patch):
> qemu-img info 
> /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2
> image: 
> /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2
> file format: qcow2
> virtual size: 40G (42949672960 bytes)
> disk size: 2.3G (2496200704 bytes)
> cluster_size: 65536
> backing file: /baseimage/img2016042213665396/img2016042213665396.qcow2
>
> the disk size reduce from 4.1G to 2.3G.
>

I find a bug for my patch.
unfortunately, when use raw format , bdrv_get_cluster_size return 1.
the raw format cluster size is 1.
and will reduce migration speed.

bdrv_get_cluster_size return bs->bl.request_alignment when cluster_size is zero.
and bs->bl.request_alignment is 1 when use raw format.

static int bdrv_get_cluster_size(BlockDriverState *bs)
{
    BlockDriverInfo bdi;
    int ret;

    ret = bdrv_get_info(bs, &bdi);
    if (ret < 0 || bdi.cluster_size == 0) {
        return bs->bl.request_alignment;
    } else {
        return bdi.cluster_size;
    }
}

so i will change to use bdrv_get_info function to get cluster_size.
and bdrv_get_cluster_size is not need to be public.

>
> On Thu, Apr 6, 2017 at 9:15 PM,  <address@hidden> wrote:
>> From: Lidong Chen <address@hidden>
>>
>> BLOCK_SIZE is (1 << 20), qcow2 cluster size is 65536 by default,
>> this maybe cause the qcow2 file size is bigger after migration.
>> This patch check each cluster, use blk_pwrite_zeroes for each
>> zero cluster.
>>
>> Lidong Chen (2):
>>   block: make bdrv_get_cluster_size public
>>   migration/block: use blk_pwrite_zeroes for each zero cluster
>>
>>  block/io.c            |  2 +-
>>  include/block/block.h |  1 +
>>  migration/block.c     | 34 ++++++++++++++++++++++++++++++++--
>>  3 files changed, 34 insertions(+), 3 deletions(-)
>>
>> --
>> 1.8.3.1
>>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]