From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve2LH-0007Sg-Uv for qemu-devel@nongnu.org; Wed, 06 Nov 2013 07:36:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ve2L8-0003Hr-QT for qemu-devel@nongnu.org; Wed, 06 Nov 2013 07:36:15 -0500 Received: from mail6.webfaction.com ([74.55.86.74]:39864 helo=smtp.webfaction.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve2L8-0003Hk-LB for qemu-devel@nongnu.org; Wed, 06 Nov 2013 07:36:06 -0500 Message-ID: <527A37B4.10202@ctshepherd.com> Date: Wed, 06 Nov 2013 12:36:04 +0000 From: Charlie Shepherd MIME-Version: 1.0 References: <1383740591-27739-1-git-send-email-charlie@ctshepherd.com> <1383740591-27739-4-git-send-email-charlie@ctshepherd.com> <527A3631.4030500@redhat.com> In-Reply-To: <527A3631.4030500@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] COW: Skip setting already set bits List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, stefanha@gmail.com, gabriel@kerneis.info, qemu-devel@nongnu.org On 06/11/2013 12:29, Paolo Bonzini wrote: > Il 06/11/2013 13:23, Charlie Shepherd ha scritto: >> + set = cow_find_streak(bitmap, 1, bitnum, sector_bits); >> + if (set == sector_bits) { >> + continue; > I think this shouldn't be a continue; these lines should be executed: > > bitnum += sector_bits; > nb_sectors -= sector_bits; > offset += BDRV_SECTOR_SIZE; Good point, this is basically a poor man's for-loop. I'll turn it into a for loop then continue will make sense here. >> + } >> + bitnum += set; > Here you're adjusting bitnum but not nb_sectors and sector_bits. Good catch. Charlie