Am 24.07.2011 21:45, schrieb Pekka Enberg: > This patch adds support for writing to zero refcount clusters. Refcount blocks > are cached in like L2 tables and flushed upon VIRTIO_BLK_T_FLUSH and when > evicted from the LRU cache. > > With this patch applied, 'qemu-img check' no longer complains about referenced > clusters with zero reference count after > > dd if=/dev/zero of=/mnt/tmp > > where '/mnt' is freshly generated QCOW2 image. > > Cc: Asias He <asias.hejun@xxxxxxxxx> > Cc: Cyrill Gorcunov <gorcunov@xxxxxxxxx> > Cc: Ingo Molnar <mingo@xxxxxxx> > Cc: Kevin Wolf <kwolf@xxxxxxxxxx> > Cc: Prasad Joshi <prasadjoshi124@xxxxxxxxx> > Cc: Sasha Levin <levinsasha928@xxxxxxxxx> > Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx> Looks okay, except that in case of a crash you'll most likely corrupt the image because the order in which refcounts and mapping are written out is completely undefined. For a reliable implementation you need to make sure that for cluster allocation you first write out the refcount update, then fsync, then write out the mapping. Otherwise if the mapping is written out first and then a crash happens, you'll have clusters that are used, but marked free, so that in the next run a second cluster can be mapped to the same location. Kevin -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html