From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXrVp-0002AO-Qr for qemu-devel@nongnu.org; Tue, 06 Dec 2011 04:40:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXrVk-000720-Bz for qemu-devel@nongnu.org; Tue, 06 Dec 2011 04:40:33 -0500 Received: from mail-fx0-f45.google.com ([209.85.161.45]:48665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXrVk-00071d-6C for qemu-devel@nongnu.org; Tue, 06 Dec 2011 04:40:28 -0500 Received: by faao26 with SMTP id o26so1092935faa.4 for ; Tue, 06 Dec 2011 01:40:26 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <4EDDDB5A.8020102@linux.vnet.ibm.com> References: <4EDDDB5A.8020102@linux.vnet.ibm.com> Date: Tue, 6 Dec 2011 09:40:26 +0000 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] About the snapshot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhi Hui Li Cc: Kevin Wolf , zhihuili@cn.ibm.com, Stefan Hajnoczi , QEMU-devel On Tue, Dec 6, 2011 at 9:07 AM, Zhi Hui Li wr= ote: > > 1) : > > for example: > > BDRVQcowState *s =3D bs->opaque; > > s->snapshots > s->nb_snapshots > > > 1:use the command: =A0 qemu-img snapshot ./test.qcow2 =A0-c aa > the memory of the s->snapshot don't free, > if the s->nb_snapshots is large, Does it have some problems. > > 2: use the command: =A0qemu-system-x86_64 =A0./test.qcow2 -snapshot > when the program ends, Does it need to free the s->snapshots ? These two commands are unrelated. QEMU uses the term "snapshot" for several different features: 1. qemu-img snapshot refers to "internal snapshots" that are contained within qcow2 image files. The savevm/loadvm/delvm monitor commands operate on internal snapshots. 2. qemu -snapshot refers to a temporary qcow2 image file created to buffer any data that the guest writes. When QEMU exits your disk image is not modified and the temporary qcow2 file is deleted. You can also apply the buffer to the disk image using the "commit" monitor command. > 2): > in the function of > qcow2_update_snapshot_refcount > > it has some " =A0goto fail =A0"; > if the function runs some times, then something makes it goto fail, > I am not sure whether it will make the refcount =A0incorrect. When an error occurs its possible that refcount leaks are introduced (the refcount was increment but will never be used), but we should never decrement a reference that is still in use. Please be more specific about the problem so that Kevin or I can take a loo= k. Stefan