diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 904f6b1f44d8d7571e0693a3c6eb0e35554ffafe..b1155492a358cf35442f08f9786c67b1af337747 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -253,7 +253,9 @@ static int qcow2_cache_find_entry_to_replace(Qcow2Cache *c) /* Give newer hits priority */ /* TODO Check how to optimize the replacement strategy */ - c->entries[i].cache_hits /= 2; + if (c->entries[i].cache_hits > 1) { + c->entries[i].cache_hits /= 2; + } } if (min_index == -1) {