[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] xbzrle: page may not be update if it has been i
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] xbzrle: page may not be update if it has been in the cache |
Date: |
Fri, 04 Apr 2014 09:04:01 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
On 04/02/2014 02:56 AM, address@hidden wrote:
> From: ChenLiang <address@hidden>
>
> The cache_insert don't check whether the page has been in the cache.
>
> Signed-off-by: ChenLiang <address@hidden>
> Signed-off-by: Gonglei <address@hidden>
> ---
> page_cache.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Eric Blake <address@hidden>
>
> diff --git a/page_cache.c b/page_cache.c
> index c78157b..78f7590 100644
> --- a/page_cache.c
> +++ b/page_cache.c
> @@ -171,7 +171,7 @@ int cache_insert(PageCache *cache, uint64_t addr, const
> uint8_t *pdata,
> /* actual update of entry */
> it = cache_get_by_addr(cache, addr);
>
> - if (it->it_data &&
> + if (it->it_data && it->it_addr != addr &&
> it->it_age + CACHED_PAGE_LIFETIME > current_age) {
> /* the cache page is fresh, don't replace it */
> return -1;
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature