qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] vmdk: fix cluster size check for flat extents
Date: Thu, 26 Sep 2013 10:29:16 +0800	[thread overview]
Message-ID: <20130926022916.GA12183@T430s.nay.redhat.com> (raw)
In-Reply-To: <1379927909-32609-1-git-send-email-famz@redhat.com>

On Mon, 09/23 17:18, Fam Zheng wrote:
> We use the extent size as cluster size for flat extents (where no L1/L2
> table is allocated so it's safe) reuse sector calculating code with
> sparse extents.
> 
> Don't pass in the cluster size for adding flat extent, just set it to
> sectors later, then the cluster size checking will not fail.
> 
> The cluster_sectors is changed to int64_t to allow big flat extent.
> 
> Without this, flat extent opening is broken:
> 
>     # qemu-img create -f vmdk -o subformat=monolithicFlat /tmp/a.vmdk 100G
>     Formatting '/tmp/a.vmdk', fmt=vmdk size=107374182400 compat6=off subformat='monolithicFlat' zeroed_grain=off
>     # qemu-img info /tmp/a.vmdk
>     image: /tmp/a.vmdk
>     file format: raw
>     virtual size: 0 (0 bytes)
>     disk size: 4.0K
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/vmdk.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/block/vmdk.c b/block/vmdk.c
> index 96ef1b5..5d56e31 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -105,7 +105,7 @@ typedef struct VmdkExtent {
>      uint32_t l2_cache_offsets[L2_CACHE_SIZE];
>      uint32_t l2_cache_counts[L2_CACHE_SIZE];
>  
> -    unsigned int cluster_sectors;
> +    int64_t cluster_sectors;
>  } VmdkExtent;
>  
>  typedef struct BDRVVmdkState {
> @@ -424,7 +424,7 @@ static int vmdk_add_extent(BlockDriverState *bs,
>      extent->l1_size = l1_size;
>      extent->l1_entry_sectors = l2_size * cluster_sectors;
>      extent->l2_size = l2_size;
> -    extent->cluster_sectors = cluster_sectors;
> +    extent->cluster_sectors = flat ? sectors : cluster_sectors;
>  
>      if (s->num_extents > 1) {
>          extent->end_sector = (*(extent - 1)).end_sector + extent->sectors;
> @@ -741,7 +741,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
>              VmdkExtent *extent;
>  
>              ret = vmdk_add_extent(bs, extent_file, true, sectors,
> -                            0, 0, 0, 0, sectors, &extent);
> +                            0, 0, 0, 0, 0, &extent);
>              if (ret < 0) {
>                  return ret;
>              }
> -- 
> 1.8.3.1
> 
> 

CC'ing qemu-stable as this applies to 1.6 as well.

Fam

      parent reply	other threads:[~2013-09-26  2:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23  9:18 [Qemu-devel] [PATCH v2] vmdk: fix cluster size check for flat extents Fam Zheng
2013-09-23  9:40 ` Fam Zheng
2013-09-24  2:41 ` [Qemu-devel] [PATCH 0/2] Fix and add test into 059 Fam Zheng
2013-09-24  2:49   ` [Qemu-devel] [PATCH 1/2] qemu-iotests: fix test case 059 Fam Zheng
2013-09-24  2:49     ` [Qemu-devel] [PATCH 2/2] qemu-iotests: add monolithicFlat creation test to 059 Fam Zheng
2013-09-24 12:49     ` [Qemu-devel] [PATCH 1/2] qemu-iotests: fix test case 059 Stefan Hajnoczi
2013-09-25  0:58       ` Fam Zheng
2013-09-25  7:17         ` Stefan Hajnoczi
2013-09-25  1:14   ` [Qemu-devel] [PATCH v2 0/2] Fix and add test into 059 Fam Zheng
2013-09-25  1:14     ` [Qemu-devel] [PATCH v2 1/2] qemu-iotests: fix test case 059 Fam Zheng
2013-09-25  1:14     ` [Qemu-devel] [PATCH v2 2/2] qemu-iotests: add monolithicFlat creation test to 059 Fam Zheng
2013-09-25  8:27       ` Kevin Wolf
2013-09-25  8:38         ` Fam Zheng
2013-09-25  9:06   ` [Qemu-devel] [PATCH v3 0/2] Fix and add test into 059 Fam Zheng
2013-09-25  9:06     ` [Qemu-devel] [PATCH v3 1/2] qemu-iotests: fix test case 059 Fam Zheng
2013-09-25  9:06     ` [Qemu-devel] [PATCH v3 2/2] qemu-iotests: add monolithicFlat creation test to 059 Fam Zheng
2013-09-25  9:45   ` [Qemu-devel] [PATCH v4 0/2] Fix and add test into 059 Fam Zheng
2013-09-25  9:45     ` [Qemu-devel] [PATCH v4 1/2] qemu-iotests: fix test case 059 Fam Zheng
2013-09-25  9:45     ` [Qemu-devel] [PATCH v4 2/2] qemu-iotests: add monolithicFlat creation test to 059 Fam Zheng
2013-09-25 10:20     ` [Qemu-devel] [PATCH v4 0/2] Fix and add test into 059 Kevin Wolf
2013-09-24  2:42 ` [Qemu-devel] [PATCH v2 " Fam Zheng
2013-09-24 12:53 ` [Qemu-devel] [PATCH v2] vmdk: fix cluster size check for flat extents Stefan Hajnoczi
2013-09-26  2:29 ` Fam Zheng [this message]

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=20130926022916.GA12183@T430s.nay.redhat.com \
    --to=famz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /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).