Received: from eggs.gnu.org ([2001:4830:134:3::10]:37498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yqlce-0002dG-5V for qemu-devel@nongnu.org; Fri, 08 May 2015 12:59:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqlcZ-0003yF-2j for qemu-devel@nongnu.org; Fri, 08 May 2015 12:59:36 -0400 From: Alberto Garcia In-Reply-To: <554CDB82.4060303@redhat.com> References: <4df51e8786b8f313066bf0d29ae4aa321a8960a8.1430919406.git.berto@igalia.com> <554CDB82.4060303@redhat.com> Date: Fri, 08 May 2015 18:59:25 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Max Reitz , qemu-devel@nongnu.org Cc: Stefan Hajnoczi , qemu-block@nongnu.org On Fri 08 May 2015 05:51:30 PM CEST, Max Reitz wrote: >> -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()? I guess the assert(c->entries[i].ref >= 0) at the end of the function already covers that case (if offset == 0 then ref == 0 as well, so it will be -1 by then). Berto