Received: from [140.186.70.92] (port=49125 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pt6SF-00065F-TA for qemu-devel@nongnu.org; Fri, 25 Feb 2011 17:48:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pt6S5-0004k5-Cf for qemu-devel@nongnu.org; Fri, 25 Feb 2011 17:48:07 -0500 Received: from e4.ny.us.ibm.com ([32.97.182.144]:52276) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pt6S5-0004k1-99 for qemu-devel@nongnu.org; Fri, 25 Feb 2011 17:47:57 -0500 Received: from d01dlp01.pok.ibm.com (d01dlp01.pok.ibm.com [9.56.224.56]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p1PMSsxi006682 for ; Fri, 25 Feb 2011 17:28:59 -0500 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 845F338C8038 for ; Fri, 25 Feb 2011 17:47:56 -0500 (EST) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p1PMluYA221378 for ; Fri, 25 Feb 2011 17:47:56 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p1PMltCn021018 for ; Fri, 25 Feb 2011 19:47:55 -0300 From: Chunqiang Tang Date: Fri, 25 Feb 2011 17:38:04 -0500 Message-Id: <1298673486-3573-24-git-send-email-ctang@us.ibm.com> In-Reply-To: <1298673486-3573-1-git-send-email-ctang@us.ibm.com> References: <1298673486-3573-1-git-send-email-ctang@us.ibm.com> Subject: [Qemu-devel] [PATCH 24/26] FVD: add impl of interface bdrv_has_zero_init() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Chunqiang Tang 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 --- 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