From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2b6Y-0005fh-VV for qemu-devel@nongnu.org; Tue, 17 May 2016 05:15:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2b6W-0007Lq-SA for qemu-devel@nongnu.org; Tue, 17 May 2016 05:15:53 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:45277 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2b6W-0007Lj-Da for qemu-devel@nongnu.org; Tue, 17 May 2016 05:15:52 -0400 From: "Denis V. Lunev" Date: Tue, 17 May 2016 12:15:42 +0300 Message-Id: <1463476543-3087-5-git-send-email-den@openvz.org> In-Reply-To: <1463476543-3087-1-git-send-email-den@openvz.org> References: <1463476543-3087-1-git-send-email-den@openvz.org> Subject: [Qemu-devel] [PATCH 4/5] qcow2: fix condition in is_zero_cluster List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: den@openvz.org, Kevin Wolf We should check for (res & BDRV_BLOCK_ZERO) only. The situation when we will have !(res & BDRV_BLOCK_DATA) and will not have BDRV_BLOCK_ZERO is not possible. Signed-off-by: Denis V. Lunev CC: Kevin Wolf --- block/qcow2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/qcow2.c b/block/qcow2.c index 97bf870..05beb64 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2412,7 +2412,7 @@ static bool is_zero_cluster(BlockDriverState *bs, int64_t start) BlockDriverState *file; int64_t res = bdrv_get_block_status_above(bs, NULL, start, s->cluster_sectors, &nr, &file); - return res >= 0 && ((res & BDRV_BLOCK_ZERO) || !(res & BDRV_BLOCK_DATA)); + return res >= 0 && (res & BDRV_BLOCK_ZERO); } static bool is_zero_cluster_top_locked(BlockDriverState *bs, int64_t start) -- 2.1.4