cryptospore / rpms / qemu-kvm

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