From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1YOn-0001Ec-WF for qemu-devel@nongnu.org; Wed, 25 Nov 2015 06:38:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1YOn-0004Lb-3r for qemu-devel@nongnu.org; Wed, 25 Nov 2015 06:38:09 -0500 References: <1448437153-27090-1-git-send-email-famz@redhat.com> <1448437153-27090-13-git-send-email-famz@redhat.com> From: Paolo Bonzini Message-ID: <56559D95.4090401@redhat.com> Date: Wed, 25 Nov 2015 12:37:57 +0100 MIME-Version: 1.0 In-Reply-To: <1448437153-27090-13-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 12/14] qemu-img: Make MapEntry a QAPI struct List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, Jeff Cody , Peter Lieven , Markus Armbruster , Stefan Hajnoczi On 25/11/2015 08:39, Fam Zheng wrote: > */ > - if (next && > - (next->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) != BDRV_BLOCK_DATA) { > - next->flags &= ~BDRV_BLOCK_DATA; > - next->flags |= BDRV_BLOCK_ZERO; > + if (next && !next->data) { > + next->zero = true; before after 0 ZERO ZERO DATA DATA DATA DATA|ZERO ZERO DATA|ZERO ZERO ZERO ZERO This would not coalesce 0 with DATA|ZERO. I think you need to do exactly as in the older code: test (!next->data || next->zero), and clear next->data. Paolo