From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqkYu-0000kC-Ax for qemu-devel@nongnu.org; Fri, 08 May 2015 11:51:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqkYt-0002Gz-8w for qemu-devel@nongnu.org; Fri, 08 May 2015 11:51:40 -0400 Message-ID: <554CDB82.4060303@redhat.com> Date: Fri, 08 May 2015 17:51:30 +0200 From: Max Reitz MIME-Version: 1.0 References: <4df51e8786b8f313066bf0d29ae4aa321a8960a8.1430919406.git.berto@igalia.com> In-Reply-To: <4df51e8786b8f313066bf0d29ae4aa321a8960a8.1430919406.git.berto@igalia.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 6/7] qcow2: make qcow2_cache_put() a void function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-devel@nongnu.org Cc: Stefan Hajnoczi , qemu-block@nongnu.org On 06.05.2015 15:39, Alberto Garcia wrote: > This function never receives an invalid table pointer, so we can make > it void and remove all the error checking code. > > Signed-off-by: Alberto Garcia > --- > block/qcow2-cache.c | 7 +------ > block/qcow2-cluster.c | 50 ++++++++++---------------------------------------- > block/qcow2-refcount.c | 29 +++++------------------------ > block/qcow2.h | 2 +- > 4 files changed, 17 insertions(+), 71 deletions(-) > > diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c > index 3137ba8..0f629c4 100644 > --- a/block/qcow2-cache.c > +++ b/block/qcow2-cache.c > @@ -332,14 +332,10 @@ int qcow2_cache_get_empty(BlockDriverState *bs, Qcow2Cache *c, uint64_t offset, > return qcow2_cache_do_get(bs, c, offset, table, false); > } > > -int qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table) > +void qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table) > { > int i = qcow2_cache_get_table_idx(bs, c, *table); > > - if (c->entries[i].offset == 0) { > - return -ENOENT; > - } > - Maybe you could replace it by assert(c->entries[i].offset != 0) just like in qcow2_cache_entry_mark_dirty() and similar to the assert() in qcow2_cache_get_table_idx()? Max