From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbvE2-0008Iw-Fv for qemu-devel@nongnu.org; Fri, 23 Nov 2012 10:31:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbvDw-0001nj-FM for qemu-devel@nongnu.org; Fri, 23 Nov 2012 10:31:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbvDw-0001nQ-89 for qemu-devel@nongnu.org; Fri, 23 Nov 2012 10:31:24 -0500 Message-ID: <50AF96C7.3030506@redhat.com> Date: Fri, 23 Nov 2012 16:31:19 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <24E144B8C0207547AD09C467A8259F755782F76D@lisa.maurer-it.com> In-Reply-To: <24E144B8C0207547AD09C467A8259F755782F76D@lisa.maurer-it.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] qcow2: slow internal snapshot creation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dietmar Maurer Cc: "qemu-devel@nongnu.org" Am 23.11.2012 08:26, schrieb Dietmar Maurer: > qcow2 snapshot on newly created files are fast: >=20 > # qemu-img create -f qcow2 test.img 200G > # time qemu-img snapshot -c snap1 test.img > real 0m0.014s >=20 > but if metadata is allocated it gets very slow: >=20 > # qemu-img create -f qcow2 -o "preallocation=3Dmetadata" test.img 200G > # time qemu-img snapshot -c snap1 test.img > real 1m20.399s >=20 > but reading the metadata is also fast: >=20 > # time qemu-img check test.img > real 0m0.371s >=20 > So why is creating a new snapshot that slow =96 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