qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Charles Arnold <carnold@suse.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, stefanha@redhat.com,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: Re: [Qemu-devel] [PATCH] block: vpc support for ~2 TB disks
Date: Tue, 13 Nov 2012 11:46:34 +0100	[thread overview]
Message-ID: <50A2250A.4070108@redhat.com> (raw)
In-Reply-To: <50A0E79F0200009100082E4C@novprvoes0310.provo.novell.com>

Il 12/11/2012 20:12, Charles Arnold ha scritto:
> Ping?
> 
> Any thoughts on whether this is acceptable?

I would like to know what is done by other platforms.  Stefano, any idea
about XenServer?

Paolo

> - Charles
> 
>>>> On 10/30/2012 at 08:59 PM, in message <50A0E561.5B74.0091.0@suse.com>, Charles
> Arnold wrote: 
>> The VHD specification allows for up to a 2 TB disk size. The current
>> implementation in qemu emulates EIDE and ATA-2 hardware which only allows
>> for up to 127 GB.  This disk size limitation can be overridden by allowing
>> up to 255 heads instead of the normal 4 bit limitation of 16.  Doing so
>> allows disk images to be created of up to nearly 2 TB.  This change does
>> not violate the VHD format specification nor does it change how smaller
>> disks (ie, <=127GB) are defined. 
>>
>> Signed-off-by: Charles Arnold <carnold@suse.com>
>>
>> diff --git a/block/vpc.c b/block/vpc.c
>> index b6bf52f..0c2eaf8 100644
>> --- a/block/vpc.c
>> +++ b/block/vpc.c
>> @@ -198,7 +198,8 @@ static int vpc_open(BlockDriverState *bs, int flags)
>>      bs->total_sectors = (int64_t)
>>          be16_to_cpu(footer->cyls) * footer->heads * footer->secs_per_cyl;
>>  
>> -    if (bs->total_sectors >= 65535 * 16 * 255) {
>> +    /* Allow a maximum disk size of approximately 2 TB */
>> +    if (bs->total_sectors >= 65535LL * 255 * 255) {qemu-devel@nongnu.org
>>          err = -EFBIG;
>>          goto fail;
>>      }
>> @@ -524,19 +525,27 @@ static coroutine_fn int vpc_co_write(BlockDriverState 
>> *bs, int64_t sector_num,
>>   * Note that the geometry doesn't always exactly match total_sectors but
>>   * may round it down.
>>   *
>> - * Returns 0 on success, -EFBIG if the size is larger than 127 GB
>> + * Returns 0 on success, -EFBIG if the size is larger than ~2 TB. Override
>> + * the hardware EIDE and ATA-2 limit of 16 heads (max disk size of 127 GB)
>> + * and instead allow up to 255 heads.
>>   */
>>  static int calculate_geometry(int64_t total_sectors, uint16_t* cyls,
>>      uint8_t* heads, uint8_t* secs_per_cyl)
>>  {
>>      uint32_t cyls_times_heads;
>>  
>> -    if (total_sectors > 65535 * 16 * 255)
>> +    /* Allow a maximum disk size of approximately 2 TB */
>> +    if (total_sectors > 65535LL * 255 * 255) {
>>          return -EFBIG;
>> +    }
>>  
>>      if (total_sectors > 65535 * 16 * 63) {
>>          *secs_per_cyl = 255;
>> -        *heads = 16;
>> +        if (total_sectors > 65535 * 16 * 255) {
>> +            *heads = 255;
>> +        } else {
>> +            *heads = 16;
>> +        }
>>          cyls_times_heads = total_sectors / *secs_per_cyl;
>>      } else {
>>          *secs_per_cyl = 17;
> 
> 
> 
> 

  reply	other threads:[~2012-11-13 10:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-12 19:12 [Qemu-devel] [PATCH] block: vpc support for ~2 TB disks Charles Arnold
2012-11-13 10:46 ` Paolo Bonzini [this message]
2012-11-13 10:56   ` Stefano Stabellini
2012-11-14 16:25     ` Thanos Makatos
2012-11-14 16:35       ` Paolo Bonzini
2012-11-15 16:46         ` Charles Arnold
2012-11-15 17:00           ` Paolo Bonzini
2012-11-15 17:48         ` Thanos Makatos
  -- strict thread matches above, loose matches on Subject: below --
2012-10-31  2:59 Charles Arnold
2012-11-19 11:50 ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50A2250A.4070108@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=carnold@suse.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).