cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
619821
From 6c316a417a80fcf892935c51eb01c0e273561b32 Mon Sep 17 00:00:00 2001
619821
From: Max Reitz <mreitz@redhat.com>
619821
Date: Mon, 13 Mar 2017 17:47:04 +0100
619821
Subject: [PATCH 16/24] blkdebug: Add bdrv_truncate()
619821
619821
RH-Author: Max Reitz <mreitz@redhat.com>
619821
Message-id: <20170313174706.29316-1-mreitz@redhat.com>
619821
Patchwork-id: 74278
619821
O-Subject: [RHEL-7.4 qemu-kvm PATCH 7/9] blkdebug: Add bdrv_truncate()
619821
Bugzilla: 1427176
619821
RH-Acked-by: Fam Zheng <famz@redhat.com>
619821
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
619821
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
619821
619821
From: Kevin Wolf <kwolf@redhat.com>
619821
619821
This is, amongst others, required for qemu-iotests 033 to run as
619821
intended on VHDX, which uses explicit bdrv_truncate() calls to bs->file
619821
when allocating new blocks.
619821
619821
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
619821
Reviewed-by: Jeff Cody <jcody@redhat.com>
619821
(cherry picked from commit 8eedfbd4a50299f03b3630659c34ad1b01f69370)
619821
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
619821
619821
Conflicts:
619821
	block/blkdebug.c
619821
619821
Contextual conflict due to blkdebug_refresh_filename() missing from
619821
downstream.
619821
619821
Signed-off-by: Max Reitz <mreitz@redhat.com>
619821
---
619821
 block/blkdebug.c | 6 ++++++
619821
 1 file changed, 6 insertions(+)
619821
619821
diff --git a/block/blkdebug.c b/block/blkdebug.c
619821
index 8e468b2..7cfeccb 100644
619821
--- a/block/blkdebug.c
619821
+++ b/block/blkdebug.c
619821
@@ -652,6 +652,11 @@ static int64_t blkdebug_getlength(BlockDriverState *bs)
619821
     return bdrv_getlength(bs->file);
619821
 }
619821
 
619821
+static int blkdebug_truncate(BlockDriverState *bs, int64_t offset)
619821
+{
619821
+    return bdrv_truncate(bs->file, offset);
619821
+}
619821
+
619821
 static BlockDriver bdrv_blkdebug = {
619821
     .format_name            = "blkdebug",
619821
     .protocol_name          = "blkdebug",
619821
@@ -661,6 +666,7 @@ static BlockDriver bdrv_blkdebug = {
619821
     .bdrv_file_open         = blkdebug_open,
619821
     .bdrv_close             = blkdebug_close,
619821
     .bdrv_getlength         = blkdebug_getlength,
619821
+    .bdrv_truncate          = blkdebug_truncate,
619821
 
619821
     .bdrv_aio_readv         = blkdebug_aio_readv,
619821
     .bdrv_aio_writev        = blkdebug_aio_writev,
619821
-- 
619821
1.8.3.1
619821