From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNTQs-0000jb-2I for qemu-devel@nongnu.org; Tue, 11 Mar 2014 16:37:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNTQn-0000OV-8x for qemu-devel@nongnu.org; Tue, 11 Mar 2014 16:37:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNTQn-0000OR-1U for qemu-devel@nongnu.org; Tue, 11 Mar 2014 16:37:45 -0400 From: Juan Quintela In-Reply-To: <1394542415-5152-5-git-send-email-arei.gonglei@huawei.com> (arei gonglei's message of "Tue, 11 Mar 2014 20:53:29 +0800") References: <1394542415-5152-1-git-send-email-arei.gonglei@huawei.com> <1394542415-5152-5-git-send-email-arei.gonglei@huawei.com> Date: Tue, 11 Mar 2014 21:37:31 +0100 Message-ID: <87k3c0320k.fsf@elfo.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 04/10] XBZRLE: rebuild the cache_is_cached function Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com Cc: ChenLiang , weidong.huang@huawei.com, qemu-devel@nongnu.org, owasserm@redhat.com, pbonzini@redhat.com wrote: > From: ChenLiang > > Rebuild the cache_is_cached function. Why? > +bool cache_is_cached(const PageCache *cache, uint64_t addr, > + uint64_t current_age) > +{ > + CacheItem *it = NULL; s/= NULL// Thanks, Juan. > + > + it = cache_get_by_addr(cache, addr); > + > + if (it->it_addr == addr) { > + /* updata the it_age when the cache hit */ > + it->it_age = current_age; > + return true; > + } > + return false; > +} > + > int cache_insert(PageCache *cache, uint64_t addr, const uint8_t *pdata, > uint64_t current_age) > {