Am 23.11.2012 08:26, schrieb Dietmar Maurer: > qcow2 snapshot on newly created files are fast: > > # qemu-img create -f qcow2 test.img 200G > # time qemu-img snapshot -c snap1 test.img > real 0m0.014s > > but if metadata is allocated it gets very slow: > > # qemu-img create -f qcow2 -o "preallocation=metadata" test.img 200G > # time qemu-img snapshot -c snap1 test.img > real 1m20.399s > > but reading the metadata is also fast: > > # time qemu-img check test.img > real 0m0.371s > > So why is creating a new snapshot that slow – any ideas?
Had a look at this now. The culprit is the unconditional bdrv_flush() in update_cluster_refcount(). I suspect it's completely unnecessary by now, but I need to give it a closer review before I send a patch to remove it. (And in any case error handling is missing there) Affected are writing compressed images and creating/deleting internal snapshots, no other code uses this path. Kevin
