aboutsummaryrefslogtreecommitdiff
path: root/block/blkdebug.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2015-04-14 16:32:45 +0200
committerKevin Wolf <kwolf@redhat.com>2015-04-28 15:36:09 +0200
commit8eedfbd4a50299f03b3630659c34ad1b01f69370 (patch)
tree9f8ca23eb8c1c40067649cf9ec293f7fe62c8cec /block/blkdebug.c
parente4f587492331df0ac50bad6131ea273d527af796 (diff)
downloadqemu-8eedfbd4a50299f03b3630659c34ad1b01f69370.zip
qemu-8eedfbd4a50299f03b3630659c34ad1b01f69370.tar.gz
qemu-8eedfbd4a50299f03b3630659c34ad1b01f69370.tar.bz2
blkdebug: Add bdrv_truncate()
This is, amongst others, required for qemu-iotests 033 to run as intended on VHDX, which uses explicit bdrv_truncate() calls to bs->file when allocating new blocks. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'block/blkdebug.c')
-rw-r--r--block/blkdebug.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blkdebug.c b/block/blkdebug.c
index 63611e0..3c30edb 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -721,6 +721,11 @@ static int64_t blkdebug_getlength(BlockDriverState *bs)
return bdrv_getlength(bs->file);
}
+static int blkdebug_truncate(BlockDriverState *bs, int64_t offset)
+{
+ return bdrv_truncate(bs->file, offset);
+}
+
static void blkdebug_refresh_filename(BlockDriverState *bs)
{
QDict *opts;
@@ -779,6 +784,7 @@ static BlockDriver bdrv_blkdebug = {
.bdrv_file_open = blkdebug_open,
.bdrv_close = blkdebug_close,
.bdrv_getlength = blkdebug_getlength,
+ .bdrv_truncate = blkdebug_truncate,
.bdrv_refresh_filename = blkdebug_refresh_filename,
.bdrv_aio_readv = blkdebug_aio_readv,