diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2013-03-04 15:02:32 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-03-15 16:07:50 +0100 |
commit | c1f5bafd70a8d9366570a3de472ef108415cd631 (patch) | |
tree | 2d074ff55407cfdab33e624972ecddda1604bb4b /block/qcow2-refcount.c | |
parent | f6977f15561973d4a67b6aa46da88aa678c505dd (diff) | |
download | qemu-c1f5bafd70a8d9366570a3de472ef108415cd631.tar.gz qemu-c1f5bafd70a8d9366570a3de472ef108415cd631.tar.bz2 qemu-c1f5bafd70a8d9366570a3de472ef108415cd631.zip |
qcow2: set L2 cache dependency in qcow2_alloc_bytes()
Compressed writes use qcow2_alloc_bytes() to allocate space with byte
granularity. The affected clusters' refcounts will be incremented but
we do not need to flush yet.
Set a L2 cache dependency on the refcount block cache, so that the
refcounts get written out before the L2 updates.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2-refcount.c')
-rw-r--r-- | block/qcow2-refcount.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index e8b5d0a4ac..4d9df5fe95 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -669,7 +669,11 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size) } } - bdrv_flush(bs->file); + /* The cluster refcount was incremented, either by qcow2_alloc_clusters() + * or explicitly by update_cluster_refcount(). Refcount blocks must be + * flushed before the caller's L2 table updates. + */ + qcow2_cache_set_dependency(bs, s->l2_table_cache, s->refcount_block_cache); return offset; } |