From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhON2-0007X2-HB for qemu-devel@nongnu.org; Fri, 15 Nov 2013 13:44:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VhOMv-0004Kh-Oo for qemu-devel@nongnu.org; Fri, 15 Nov 2013 13:43:56 -0500 Received: from mail6.webfaction.com ([74.55.86.74]:40922 helo=smtp.webfaction.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhOMv-0004Jv-Jo for qemu-devel@nongnu.org; Fri, 15 Nov 2013 13:43:49 -0500 Message-ID: <52866B64.6020402@ctshepherd.com> Date: Fri, 15 Nov 2013 18:43:48 +0000 From: Charlie Shepherd MIME-Version: 1.0 References: <1383753568-15844-1-git-send-email-charlie@ctshepherd.com> <1383753568-15844-2-git-send-email-charlie@ctshepherd.com> <20131113125912.GC2633@dhcp-200-207.str.redhat.com> In-Reply-To: <20131113125912.GC2633@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 1/2] COW: Speed up writes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: pbonzini@redhat.com, gabriel@kerneis.info, qemu-devel@nongnu.org, stefanha@gmail.com On 13/11/2013 12:59, Kevin Wolf wrote: > Am 06.11.2013 um 16:59 hat Charlie Shepherd geschrieben: >> Process a whole sector's worth of COW bits by reading a sector, setting the bits after skipping >> any already set bits, then writing it out again. Make sure we only flush once before writing >> metadata, and only if we need to write metadata. >> >> Signed-off-by: Charlie Shepherd >> --- >> block/cow.c | 87 ++++++++++++++++++++++++++++++++++--------------------------- >> 1 file changed, 49 insertions(+), 38 deletions(-) >> @@ -204,18 +182,51 @@ static int64_t coroutine_fn cow_co_get_block_status(BlockDriverState *bs, >> static int cow_update_bitmap(BlockDriverState *bs, int64_t sector_num, >> int nb_sectors) >> { >> - int error = 0; >> - int i; >> + int64_t bitnum = sector_num + sizeof(struct cow_header_v2) * 8; >> + uint64_t offset = (bitnum / 8) & -BDRV_SECTOR_SIZE; >> bool first = true; >> >> - for (i = 0; i < nb_sectors; i++) { >> - error = cow_set_bit(bs, sector_num + i, &first); >> - if (error) { >> - break; >> + for ( ; nb_sectors; >> + bitnum += sector_bits, >> + nb_sectors -= sector_bits, >> + offset += BDRV_SECTOR_SIZE) { > block/cow.c: In function 'cow_update_bitmap': > block/cow.c:206:23: error: 'sector_bits' undeclared (first use in this function) Sorry I should have caught that, resending a new version. Charlie