bool qcow2_cache_set_writethrough(BlockDriverState *bs, Qcow2Cache *c, bool enable) { bool old = c->writethrough; if (!old && enable) { qcow2_cache_flush(bs, c); } c->writethrough = enable; return old; }
static int qcow2_cache_flush_dependency(BlockDriverState *bs, Qcow2Cache *c) { int ret; ret = qcow2_cache_flush(bs, c->depends); if (ret < 0) { return ret; } c->depends = NULL; c->depends_on_flush = false; return 0; }
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; }
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].lru_counter = 0; } qcow2_cache_table_release(bs, c, 0, c->size); c->lru_counter = 0; return 0; }