[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 18/20] vpc: Implement .bdrv_has_zero_init
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 18/20] vpc: Implement .bdrv_has_zero_init |
Date: |
Fri, 28 Jun 2013 16:25:07 +0200 |
Depending on the subformat, has_zero_init on VHD must behave like raw
and query the underlying storage (fixed) or like other sparse formats
that can always return 1 (dynamic, differencing).
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vpc.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/block/vpc.c b/block/vpc.c
index 3cad52e..fe4f311 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -786,6 +786,18 @@ static int vpc_create(const char *filename,
QEMUOptionParameter *options)
return ret;
}
+static int vpc_has_zero_init(BlockDriverState *bs)
+{
+ BDRVVPCState *s = bs->opaque;
+ struct vhd_footer *footer = (struct vhd_footer *) s->footer_buf;
+
+ if (cpu_to_be32(footer->type) == VHD_FIXED) {
+ return bdrv_has_zero_init(bs->file);
+ } else {
+ return 1;
+ }
+}
+
static void vpc_close(BlockDriverState *bs)
{
BDRVVPCState *s = bs->opaque;
@@ -818,16 +830,17 @@ static BlockDriver bdrv_vpc = {
.format_name = "vpc",
.instance_size = sizeof(BDRVVPCState),
- .bdrv_probe = vpc_probe,
- .bdrv_open = vpc_open,
- .bdrv_close = vpc_close,
- .bdrv_reopen_prepare = vpc_reopen_prepare,
- .bdrv_create = vpc_create,
+ .bdrv_probe = vpc_probe,
+ .bdrv_open = vpc_open,
+ .bdrv_close = vpc_close,
+ .bdrv_reopen_prepare = vpc_reopen_prepare,
+ .bdrv_create = vpc_create,
.bdrv_read = vpc_co_read,
.bdrv_write = vpc_co_write,
- .create_options = vpc_create_options,
+ .create_options = vpc_create_options,
+ .bdrv_has_zero_init = vpc_has_zero_init,
};
static void bdrv_vpc_init(void)
--
1.8.1.4
- [Qemu-devel] [PULL 09/20] blockdev: allow BdrvActionOps->commit() to be NULL, (continued)
- [Qemu-devel] [PULL 09/20] blockdev: allow BdrvActionOps->commit() to be NULL, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 07/20] block: add drive-backup QMP command, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 10/20] blockdev: add DriveBackup transaction, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 08/20] blockdev: rename BlkTransactionStates to singular, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 11/20] blockdev: add Abort transaction, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 12/20] qemu-iotests: extract wait_until_completed() into iotests.py, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 15/20] block/ssh: Set bdrv_has_zero_init according to the file type., Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 13/20] qemu-iotests: add 055 drive-backup test case, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 14/20] block: Make BlockJobTypes const, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 16/20] gluster: Return bdrv_has_zero_init = 0, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 18/20] vpc: Implement .bdrv_has_zero_init,
Kevin Wolf <=
- [Qemu-devel] [PULL 19/20] block: change default of .has_zero_init to 0, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 20/20] cmd646: fix build when DEBUG_IDE is enabled., Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 17/20] vmdk: remove wrong calculation of relative path, Kevin Wolf, 2013/06/28