From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBM9P-0005YQ-G5 for qemu-devel@nongnu.org; Mon, 19 Aug 2013 05:53:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBM9J-0003qA-NW for qemu-devel@nongnu.org; Mon, 19 Aug 2013 05:53:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49516) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBM9J-0003pz-Eh for qemu-devel@nongnu.org; Mon, 19 Aug 2013 05:53:21 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7J9rKcl010099 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 19 Aug 2013 05:53:20 -0400 Date: Mon, 19 Aug 2013 11:53:23 +0200 From: Kevin Wolf Message-ID: <20130819095323.GB5098@dhcp-200-207.str.redhat.com> References: <1376356869-19417-1-git-send-email-famz@redhat.com> <1376356869-19417-2-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1376356869-19417-2-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 1/4] vmdk: fix L1 and L2 table size in vmdk3 open List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: pbonzini@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Am 13.08.2013 um 03:21 hat Fam Zheng geschrieben: > VMDK3 header has the field l1dir_size, but vmdk_open_vmdk3 hardcoded the > value. This patch honors the header field. > > And the L2 table size is 4096 according to VMDK spec[1], instead of > 1 << 9 (512). > > [1]: > http://www.vmware.com/support/developer/vddk/vmdk_50_technote.pdf?src=vmdk > > Signed-off-by: Fam Zheng > --- > block/vmdk.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/block/vmdk.c b/block/vmdk.c > index 346bb5c..1392542 100644 > --- a/block/vmdk.c > +++ b/block/vmdk.c > @@ -486,14 +486,14 @@ static int vmdk_open_vmdk3(BlockDriverState *bs, > if (ret < 0) { > return ret; > } > - > - ret = vmdk_add_extent(bs, > - bs->file, false, > - le32_to_cpu(header.disk_sectors), > - le32_to_cpu(header.l1dir_offset) << 9, > - 0, 1 << 6, 1 << 9, > - le32_to_cpu(header.granularity), > - &extent); > + ret = vmdk_add_extent(bs, file, false, > + le32_to_cpu(header.disk_sectors), > + le32_to_cpu(header.l1dir_offset) << 9, > + 0, > + le32_to_cpu(header.l1dir_size), > + 4096, > + le32_to_cpu(header.granularity), > + &extent); You'll want to add a sanity check for header.l1dir_dir, or move the existing check from vmdk_open_vmdk4() to vmdk_add_extent(). Kevin