Add check for cache size smaller than page size

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
Orit Wasserman 2014-01-30 20:08:34 +02:00 committed by Juan Quintela
parent f6c6483b25
commit c91e681a55
2 changed files with 13 additions and 1 deletions

View file

@ -178,6 +178,10 @@ static struct {
int64_t xbzrle_cache_resize(int64_t new_size)
{
if (new_size < TARGET_PAGE_SIZE) {
return -1;
}
if (XBZRLE.cache != NULL) {
return cache_resize(XBZRLE.cache, new_size / TARGET_PAGE_SIZE) *
TARGET_PAGE_SIZE;