diff options
author | Fam Zheng <famz@redhat.com> | 2014-05-06 21:08:44 +0800 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2014-05-09 13:32:16 +0200 |
commit | ba0ad89e2c3316ce26ca6576a3c5051f91bfc0fe (patch) | |
tree | 3f12a325c3f53ffb1b1b2d83eb95b63a0e8cadb2 /block | |
parent | 85f49cad879adfb5c3cbdc47ca3c3b50eb8f40bc (diff) |
vmdk: Implement .bdrv_write_compressed
Add a wrapper function to support "compressed" path in qemu-img convert.
Only support streamOptimized subformat case for now (num_extents == 1
and extent compression is true).
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/vmdk.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/block/vmdk.c b/block/vmdk.c index 06a1f9f93b..057c3f1fcd 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1496,6 +1496,19 @@ static coroutine_fn int vmdk_co_write(BlockDriverState *bs, int64_t sector_num, return ret; } +static int vmdk_write_compressed(BlockDriverState *bs, + int64_t sector_num, + const uint8_t *buf, + int nb_sectors) +{ + BDRVVmdkState *s = bs->opaque; + if (s->num_extents == 1 && s->extents[0].compressed) { + return vmdk_write(bs, sector_num, buf, nb_sectors, false, false); + } else { + return -ENOTSUP; + } +} + static int coroutine_fn vmdk_co_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, @@ -2109,6 +2122,7 @@ static BlockDriver bdrv_vmdk = { .bdrv_reopen_prepare = vmdk_reopen_prepare, .bdrv_read = vmdk_co_read, .bdrv_write = vmdk_co_write, + .bdrv_write_compressed = vmdk_write_compressed, .bdrv_co_write_zeroes = vmdk_co_write_zeroes, .bdrv_close = vmdk_close, .bdrv_create = vmdk_create, |