|
|
9ae3a8 |
From 0e4b156f5e4c928c2f98c21d029b0b1c361bd2a8 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Jeffrey Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 16 Sep 2014 20:11:48 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 10/20] vpc: Implement .bdrv_has_zero_init
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <f9375563af1f63122af308c2f924f154e54e47d4.1410897407.git.jcody@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 61214
|
|
|
9ae3a8 |
O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 09/15] vpc: Implement .bdrv_has_zero_init
|
|
|
9ae3a8 |
Bugzilla: 1098086
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Depending on the subformat, has_zero_init on VHD must behave like raw
|
|
|
9ae3a8 |
and query the underlying storage (fixed) or like other sparse formats
|
|
|
9ae3a8 |
that can always return 1 (dynamic, differencing).
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 72c6cc94daa727f41ecfc2b2ff94aa6f0e459b7f)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
block/vpc.c
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RHEL7 Notes: Conflict due to out of order commits
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Jeff Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/vpc.c | 28 +++++++++++++++++++++-------
|
|
|
9ae3a8 |
1 files changed, 21 insertions(+), 7 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block/vpc.c b/block/vpc.c
|
|
|
9ae3a8 |
index 6e8fb33..2f3d4ac 100644
|
|
|
9ae3a8 |
--- a/block/vpc.c
|
|
|
9ae3a8 |
+++ b/block/vpc.c
|
|
|
9ae3a8 |
@@ -826,6 +826,18 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options,
|
|
|
9ae3a8 |
return ret;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+static int vpc_has_zero_init(BlockDriverState *bs)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ BDRVVPCState *s = bs->opaque;
|
|
|
9ae3a8 |
+ struct vhd_footer *footer = (struct vhd_footer *) s->footer_buf;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (cpu_to_be32(footer->type) == VHD_FIXED) {
|
|
|
9ae3a8 |
+ return bdrv_has_zero_init(bs->file);
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ return 1;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static void vpc_close(BlockDriverState *bs)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVVPCState *s = bs->opaque;
|
|
|
9ae3a8 |
@@ -858,17 +870,19 @@ static BlockDriver bdrv_vpc = {
|
|
|
9ae3a8 |
.format_name = "vpc",
|
|
|
9ae3a8 |
.instance_size = sizeof(BDRVVPCState),
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- .bdrv_probe = vpc_probe,
|
|
|
9ae3a8 |
- .bdrv_open = vpc_open,
|
|
|
9ae3a8 |
- .bdrv_close = vpc_close,
|
|
|
9ae3a8 |
- .bdrv_reopen_prepare = vpc_reopen_prepare,
|
|
|
9ae3a8 |
- .bdrv_create = vpc_create,
|
|
|
9ae3a8 |
+ .bdrv_probe = vpc_probe,
|
|
|
9ae3a8 |
+ .bdrv_open = vpc_open,
|
|
|
9ae3a8 |
+ .bdrv_close = vpc_close,
|
|
|
9ae3a8 |
+ .bdrv_reopen_prepare = vpc_reopen_prepare,
|
|
|
9ae3a8 |
+ .bdrv_create = vpc_create,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
.bdrv_read = vpc_co_read,
|
|
|
9ae3a8 |
.bdrv_write = vpc_co_write,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- .create_options = vpc_create_options,
|
|
|
9ae3a8 |
- .bdrv_get_info = vpc_get_info,
|
|
|
9ae3a8 |
+ .bdrv_get_info = vpc_get_info,
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ .create_options = vpc_create_options,
|
|
|
9ae3a8 |
+ .bdrv_has_zero_init = vpc_has_zero_init,
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void bdrv_vpc_init(void)
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|