qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 24/26] FVD: add impl of interface bdrv_has_zero_init


From: Chunqiang Tang
Subject: [Qemu-devel] [PATCH 24/26] FVD: add impl of interface bdrv_has_zero_init()
Date: Fri, 25 Feb 2011 17:38:04 -0500

This patch is part of the Fast Virtual Disk (FVD) proposal.
See http://wiki.qemu.org/Features/FVD.

This patch adds FVD's implementation of the bdrv_has_zero_init() interface.

Signed-off-by: Chunqiang Tang <address@hidden>
---
 block/fvd-misc.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/block/fvd-misc.c b/block/fvd-misc.c
index 766b62b..61e39bb 100644
--- a/block/fvd-misc.c
+++ b/block/fvd-misc.c
@@ -341,5 +341,12 @@ static int fvd_get_info(BlockDriverState * bs, 
BlockDriverInfo * bdi)
 
 static int fvd_has_zero_init(BlockDriverState * bs)
 {
-    return 0;
+    BDRVFvdState *s = bs->opaque;
+
+    /* For a non-compact image, chunks_relocated is always false. For a
+     * compact image with chunks_relocated=true, it can no longer guarantee
+     * zero init even if the file system does that. This is because a partialy
+     * written chunk X may be relocated to a location previously used by
+     * another chunk Y and some garbage data are left there by Y. */
+    return s->chunks_relocated ? 0 : bdrv_has_zero_init(s->fvd_data);
 }
-- 
1.7.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]