Don't abort on memory allocation error

It is better to fail migration in case of failure to
allocate new cache item

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
Orit Wasserman 2014-01-30 20:08:38 +02:00 committed by Juan Quintela
parent a17b2fd358
commit 89db9987c0
3 changed files with 17 additions and 7 deletions

View file

@ -60,11 +60,13 @@ uint8_t *get_cached_data(const PageCache *cache, uint64_t addr);
* cache_insert: insert the page into the cache. the page cache
* will dup the data on insert. the previous value will be overwritten
*
* Returns -1 on error
*
* @cache pointer to the PageCache struct
* @addr: page address
* @pdata: pointer to the page
*/
void cache_insert(PageCache *cache, uint64_t addr, uint8_t *pdata);
int cache_insert(PageCache *cache, uint64_t addr, uint8_t *pdata);
/**
* cache_resize: resize the page cache. In case of size reduction the extra