Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
qemu-linux-user.11147
0061-vmdk-Implement-.bdrv_get_info.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0061-vmdk-Implement-.bdrv_get_info.patch of Package qemu-linux-user.11147
From cfb9355ee62fd271a53c50944f02ade5f7528a64 Mon Sep 17 00:00:00 2001 From: Fam Zheng <famz@redhat.com> Date: Tue, 6 May 2014 21:08:45 +0800 Subject: [PATCH] vmdk: Implement .bdrv_get_info() This will return cluster_size and needs_compressed_writes to caller, if all the extents have the same value (or there's only one extent). Otherwise return -ENOTSUP. cluster_size is only reported for sparse formats. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> (cherry picked from commit 74fe188cd1a27a5565787152d8620f8b8d04c4f9) [BR: FATE#317741] Signed-off-by: Bruce Rogers <brogers@suse.com> --- block/vmdk.c | 21 +++++++++++++++++++++ tests/qemu-iotests/059.out | 1 + 2 files changed, 22 insertions(+) diff --git a/block/vmdk.c b/block/vmdk.c index 6b1d8fdc91..f05eb582de 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2080,6 +2080,26 @@ static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs) return spec_info; } +static int vmdk_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) +{ + int i; + BDRVVmdkState *s = bs->opaque; + assert(s->num_extents); + bdi->needs_compressed_writes = s->extents[0].compressed; + if (!s->extents[0].flat) { + bdi->cluster_size = s->extents[0].cluster_sectors << BDRV_SECTOR_BITS; + } + /* See if we have multiple extents but they have different cases */ + for (i = 1; i < s->num_extents; i++) { + if (bdi->needs_compressed_writes != s->extents[i].compressed || + (bdi->cluster_size && bdi->cluster_size != + s->extents[i].cluster_sectors << BDRV_SECTOR_BITS)) { + return -ENOTSUP; + } + } + return 0; +} + static QEMUOptionParameter vmdk_create_options[] = { { .name = BLOCK_OPT_SIZE, @@ -2146,6 +2166,7 @@ static BlockDriver bdrv_vmdk = { .bdrv_has_zero_init = vmdk_has_zero_init, .bdrv_get_specific_info = vmdk_get_specific_info, .bdrv_refresh_limits = vmdk_refresh_limits, + .bdrv_get_info = vmdk_get_info, .create_options = vmdk_create_options, }; diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out index 3371c867bb..14c0957126 100644 --- a/tests/qemu-iotests/059.out +++ b/tests/qemu-iotests/059.out @@ -2050,6 +2050,7 @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': File truncated, expecting at least image: TEST_DIR/iotest-version3.IMGFMT file format: IMGFMT virtual size: 1.0G (1073741824 bytes) +cluster_size: 65536 === Testing 4TB monolithicFlat creation and IO === Formatting 'TEST_DIR/iotest-version3.IMGFMT', fmt=IMGFMT size=4398046511104
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor