On Tue, Feb 19, 2013 at 04:45:03PM +0100, Stefan Hajnoczi wrote: > It is not completely clear to me what is being flushed in > qcow2_alloc_bytes() but bdrv_flush(bs->file) is probably wrong. At > least the refcount cache should be flushed since this function calls > update_cluster_refcount(). > > To be on the safe side, call the full bdrv_flush(bs). This flushes all > caches and the underlying file itself. > > Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>
To me it looks as if qcow2_alloc_compressed_cluster_offset() would need a call to qcow2_cache_set_dependency() like there is already for the uncompressed case in qcow2_alloc_cluster_link_l2(). Once we have that, the unconditional flush can be removed. I guess this will be a major performance improvement for converting to compressed qcow2. The bdrv_flush() ended up here only because I pushed the flush from qcow2_alloc_clusters() to its callers so I could remove it from the common fast path. All surviving instances from this still need review. Kevin