Message ID | 1379927909-32609-1-git-send-email-famz@redhat.com |
---|---|
State | New |
Headers | show |
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> > --- When adding a test case, iotests case 059 seems broken now, it will perhaps take some time to check and I'll post a fix together with test case for this later. Fam
The first fixes 059 to follow latest error message change in block layer. The second adds a test for monolithiFlat vmdk. Fam Zheng (2): qemu-iotests: fix test case 059 qemu-iotests: add monolithicFlat creation test to 059 tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-)
The first fixes 059 to follow latest error message change in block layer. The second adds a test for monolithiFlat vmdk. Fam Zheng (2): qemu-iotests: fix test case 059 qemu-iotests: add monolithicFlat creation test to 059 tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-)
On Mon, Sep 23, 2013 at 05:18:29PM +0800, 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. This is a little hacky, the next person that modifies vmdk may not be aware of this trick. I would avoid using ->cluster_sectors at all with flat extents. But I didn't investigate how feasible that approach is... Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
The first fixes 059 to follow latest error message change in block layer. The second adds a test for monolithiFlat vmdk. v2: Drop space changes Fam Zheng (2): qemu-iotests: fix test case 059 qemu-iotests: add monolithicFlat creation test to 059 tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
The first fixes 059 to follow latest error message change in block layer. The second adds a test for monolithiFlat vmdk. v3: filter test dir in script and output file. v2: Drop space changes Fam Zheng (2): qemu-iotests: fix test case 059 qemu-iotests: add monolithicFlat creation test to 059 tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
The first fixes 059 to follow latest error message change in block layer. The second adds a test for monolithiFlat vmdk. v4: Bigger image size to catch the cluster size checking issue. v3: filter test dir in script and output file. v2: Drop space changes Fam Zheng (2): qemu-iotests: fix test case 059 qemu-iotests: add monolithicFlat creation test to 059 tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
Am 25.09.2013 um 11:45 hat Fam Zheng geschrieben: > The first fixes 059 to follow latest error message change in block layer. > > The second adds a test for monolithiFlat vmdk. > > v4: Bigger image size to catch the cluster size checking issue. > v3: filter test dir in script and output file. > v2: Drop space changes > > > Fam Zheng (2): > qemu-iotests: fix test case 059 > qemu-iotests: add monolithicFlat creation test to 059 > > tests/qemu-iotests/059 | 5 +++++ > tests/qemu-iotests/059.out | 13 ++++++++++--- > 2 files changed, 15 insertions(+), 3 deletions(-) Thanks applied the vmdk patch and this series to the block branch. Kevin
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
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; }
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(-)