qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] block: Add support for vpc Fixed Disk type


From: Charles Arnold
Subject: Re: [Qemu-devel] [PATCH] block: Add support for vpc Fixed Disk type
Date: Mon, 06 Feb 2012 16:48:27 -0700

>>> On 2/6/2012 at 09:51 AM, in message <address@hidden>, Kevin Wolf
<address@hidden> wrote: 
> Am 06.02.2012 17:22, schrieb Charles Arnold:
>>>>> On 2/6/2012 at 08:46 AM, in message <address@hidden>, Kevin Wolf
>> <address@hidden> wrote: 
>>>
>>> Somehow you lost the ret = -EFBIG here.
>>>
>>> Otherwise the patch looks good enough for me.
>>>
>>> Kevin
>> 
>> Thanks Kevin.  Here is the revised patch with just this fix.
>> - Charles
> 
> Thanks, applied to the block branch.
> 
> I have one question left, though:
> 
>> +    total_sectors = total_size / BDRV_SECTOR_SIZE;
>> +    if (disk_type == VHD_DYNAMIC) {
>> +        /* Calculate matching total_size and geometry. Increase the number 
> of
>> +           sectors requested until we get enough (or fail). */
>> +        for (i = 0; total_sectors > (int64_t)cyls * heads * secs_per_cyl;
>> +             i++) {
>> +            if (calculate_geometry(total_sectors + i,
>> +                                   &cyls, &heads, &secs_per_cyl)) {
>> +                ret = -EFBIG;
>> +                goto fail;
>> +            }
>> +        }
>> +    } else {
>> +        if (calculate_geometry(total_sectors, &cyls, &heads, 
>> &secs_per_cyl)) {
>> +            ret = -EFBIG;
>> +            goto fail;
>> +        }
>> +    }
> 
> What's the reason that we need to do things differently here depending
> on the subformat? Dynamic disks round up the size so that during image
> conversion images won't be truncated. For fixed images,
> calculate_geometry can round down, so don't fixed image have the same
> problem?

Yes. In my testing I was simply creating a fixed disk that would appear exactly 
as 
it does when an equivalent size was created on windows.  I did not factor in 
the rounding needed on convert in order to get the right number of sectors
to cover the total (and somewhat arbitrary) size of the disk.
Combining them means that we will usually round up a little bit even on create 
which I suppose is fine. 

- Charles





reply via email to

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