From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoFbS-0001t2-FH for qemu-devel@nongnu.org; Wed, 04 Dec 2013 11:47:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoFbI-0004IP-6U for qemu-devel@nongnu.org; Wed, 04 Dec 2013 11:47:10 -0500 Received: from mail-ea0-x230.google.com ([2a00:1450:4013:c01::230]:60093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoFbH-0004IJ-Va for qemu-devel@nongnu.org; Wed, 04 Dec 2013 11:47:00 -0500 Received: by mail-ea0-f176.google.com with SMTP id h14so10830906eaj.35 for ; Wed, 04 Dec 2013 08:46:59 -0800 (PST) Date: Wed, 4 Dec 2013 17:46:56 +0100 From: Stefan Hajnoczi Message-ID: <20131204164656.GF27759@stefanha-thinkpad.redhat.com> References: <1385546829-3839-1-git-send-email-pl@kamp.de> <1385546829-3839-2-git-send-email-pl@kamp.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1385546829-3839-2-git-send-email-pl@kamp.de> Subject: Re: [Qemu-devel] [PATCHv3 1.8 1/9] qemu-img: add support for skipping zeroes in input during convert List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Wed, Nov 27, 2013 at 11:07:01AM +0100, Peter Lieven wrote: > + /* If the output image is being created as a copy on write > + * image, assume that sectors which are unallocated in the > + * input image are present in both the output's and input's > + * base images (no need to copy them). */ > + if (out_baseimg) { > + if (!(ret & BDRV_BLOCK_DATA)) { > + sector_num += n1; > + continue; > + } > + /* The next 'n1' sectors are allocated in the input image. > + * Copy only those as they may be followed by unallocated > + * sectors. */ > + nb_sectors = n1; > + } > + /* avoid redundant callouts to get_block_status */ > + sector_num_next_status = sector_num + n1; Can you explain when we need sector_num_next_status? It's not clear to me from this patch when we will loop around already knowing that blocks are allocated.