From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJkPQ-0002Bd-GC for qemu-devel@nongnu.org; Fri, 06 Feb 2015 10:01:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJkPL-00053u-HB for qemu-devel@nongnu.org; Fri, 06 Feb 2015 10:01:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJkPL-00053l-AR for qemu-devel@nongnu.org; Fri, 06 Feb 2015 10:01:23 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t16F1Kko014347 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 6 Feb 2015 10:01:21 -0500 Date: Fri, 6 Feb 2015 16:01:18 +0100 From: Kevin Wolf Message-ID: <20150206150118.GG13081@noname.redhat.com> References: <1423233556-19394-1-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423233556-19394-1-git-send-email-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3] qcow2: Rewrite qcow2_alloc_bytes() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Am 06.02.2015 um 15:39 hat Max Reitz geschrieben: > qcow2_alloc_bytes() is a function with insufficient error handling and > an unnecessary goto. This patch rewrites it. > > Signed-off-by: Max Reitz > --- > v3: > - Use alloc_clusters_noref() and update_refcount() [Kevin] > - Only modify s->free_byte_offset if the function is successful; this is > now necessary because update_refcount() is called unconditionally and > thus, if it failed and alloc_clusters_noref() had been called and > had returned a non-contiguous offset, s->free_byte_offset would point > to an unallocated cluster's head, which is both wrong in itself and > would also violate the assertion at the beginning of the function Looks much nicer, I think. :-) Thanks, applied to the block branch. Kevin