[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 3/6] qcow2: set L2 cache dependency in qcow2_allo
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH v2 3/6] qcow2: set L2 cache dependency in qcow2_alloc_bytes() |
Date: |
Mon, 4 Mar 2013 15:02:32 +0100 |
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 <address@hidden>
---
block/qcow2-refcount.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index e8b5d0a..4d9df5f 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;
}
--
1.8.1.4
- [Qemu-devel] [PATCH v2 0/6] qcow2: cache flush fixes and performance improvements, Stefan Hajnoczi, 2013/03/04
- [Qemu-devel] [PATCH v2 1/6] qcow2: flush refcount cache correctly in alloc_refcount_block(), Stefan Hajnoczi, 2013/03/04
- [Qemu-devel] [PATCH v2 2/6] qcow2: flush refcount cache correctly in qcow2_write_snapshots(), Stefan Hajnoczi, 2013/03/04
- [Qemu-devel] [PATCH v2 3/6] qcow2: set L2 cache dependency in qcow2_alloc_bytes(),
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH v2 5/6] qcow2: drop flush in update_cluster_refcount(), Stefan Hajnoczi, 2013/03/04
- [Qemu-devel] [PATCH v2 6/6] qcow2: drop unnecessary flush in qcow2_update_snapshot_refcount(), Stefan Hajnoczi, 2013/03/04
- [Qemu-devel] [PATCH v2 4/6] qcow2: flush in qcow2_update_snapshot_refcount(), Stefan Hajnoczi, 2013/03/04
- Re: [Qemu-devel] [PATCH v2 0/6] qcow2: cache flush fixes and performance improvements, Kevin Wolf, 2013/03/04