Loading block/qcow2-cache.c +18 −0 Original line number Diff line number Diff line Loading @@ -202,6 +202,24 @@ void qcow2_cache_depends_on_flush(Qcow2Cache *c) c->depends_on_flush = true; } int qcow2_cache_empty(BlockDriverState *bs, Qcow2Cache *c) { int ret, i; ret = qcow2_cache_flush(bs, c); if (ret < 0) { return ret; } for (i = 0; i < c->size; i++) { assert(c->entries[i].ref == 0); c->entries[i].offset = 0; c->entries[i].cache_hits = 0; } return 0; } static int qcow2_cache_find_entry_to_replace(Qcow2Cache *c) { int i; Loading block/qcow2.h +2 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,8 @@ int qcow2_cache_set_dependency(BlockDriverState *bs, Qcow2Cache *c, Qcow2Cache *dependency); void qcow2_cache_depends_on_flush(Qcow2Cache *c); int qcow2_cache_empty(BlockDriverState *bs, Qcow2Cache *c); int qcow2_cache_get(BlockDriverState *bs, Qcow2Cache *c, uint64_t offset, void **table); int qcow2_cache_get_empty(BlockDriverState *bs, Qcow2Cache *c, uint64_t offset, Loading Loading
block/qcow2-cache.c +18 −0 Original line number Diff line number Diff line Loading @@ -202,6 +202,24 @@ void qcow2_cache_depends_on_flush(Qcow2Cache *c) c->depends_on_flush = true; } int qcow2_cache_empty(BlockDriverState *bs, Qcow2Cache *c) { int ret, i; ret = qcow2_cache_flush(bs, c); if (ret < 0) { return ret; } for (i = 0; i < c->size; i++) { assert(c->entries[i].ref == 0); c->entries[i].offset = 0; c->entries[i].cache_hits = 0; } return 0; } static int qcow2_cache_find_entry_to_replace(Qcow2Cache *c) { int i; Loading
block/qcow2.h +2 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,8 @@ int qcow2_cache_set_dependency(BlockDriverState *bs, Qcow2Cache *c, Qcow2Cache *dependency); void qcow2_cache_depends_on_flush(Qcow2Cache *c); int qcow2_cache_empty(BlockDriverState *bs, Qcow2Cache *c); int qcow2_cache_get(BlockDriverState *bs, Qcow2Cache *c, uint64_t offset, void **table); int qcow2_cache_get_empty(BlockDriverState *bs, Qcow2Cache *c, uint64_t offset, Loading