qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH] vmdk: Fix next_cluster_sector for compressed wr


From: Radoslav Gerganov
Subject: Re: [Qemu-block] [PATCH] vmdk: Fix next_cluster_sector for compressed write
Date: Thu, 10 Sep 2015 11:48:06 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0

On 10.09.2015 11:15, Fam Zheng wrote:
> On Thu, 09/10 10:53, Radoslav Gerganov wrote:
>> When the VMDK is streamOptimized (or compressed), the
>> next_cluster_sector must not be incremented by a fixed number of
>> sectors. Instead of this, it must be rounded up to the next consecutive
>> sector. Fixing this results in much smaller compressed images.
>>
>> Signed-off-by: Radoslav Gerganov <address@hidden>
> 
> Is this patch enough to produce a valid streamOptimized image? Because I
> remember there were reports on some other issues with footer or grain markers.
> 
> Fam

The VMDK spec says that each marker and its associated block must begin on
sector boundary which is true before and after my patch.  However, with my
patch we don't put empty sectors when we achieve good compression for the
current cluster but start the next cluster on the next consecutive sector.

I have also verified that images produced with my patch can be booted in
VMware Workstation.

-Rado

>> ---
>>  block/vmdk.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/block/vmdk.c b/block/vmdk.c
>> index fbaab67..3bd5ccd 100644
>> --- a/block/vmdk.c
>> +++ b/block/vmdk.c
>> @@ -1324,8 +1324,12 @@ static int vmdk_write_extent(VmdkExtent *extent, 
>> int64_t cluster_offset,
>>  
>>      write_end_sector = DIV_ROUND_UP(write_offset + write_len, 
>> BDRV_SECTOR_SIZE);
>>  
>> -    extent->next_cluster_sector = MAX(extent->next_cluster_sector,
>> -                                      write_end_sector);
>> +    if (extent->compressed) {
>> +        extent->next_cluster_sector = write_end_sector;
>> +    } else {
>> +        extent->next_cluster_sector = MAX(extent->next_cluster_sector,
>> +                                          write_end_sector);
>> +    }
>>  
>>      if (ret != write_len) {
>>          ret = ret < 0 ? ret : -EIO;
>> -- 
>> 1.9.1
>>



reply via email to

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