From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXrqD-0005Cg-B4 for qemu-devel@nongnu.org; Tue, 06 Dec 2011 05:01:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXrq4-000285-Nb for qemu-devel@nongnu.org; Tue, 06 Dec 2011 05:01:37 -0500 Received: from e28smtp01.in.ibm.com ([122.248.162.1]:45190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXrq3-00027T-Qv for qemu-devel@nongnu.org; Tue, 06 Dec 2011 05:01:28 -0500 Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 6 Dec 2011 15:31:19 +0530 Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pB6A1C4I2002996 for ; Tue, 6 Dec 2011 15:31:15 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pB6A1B5k021122 for ; Tue, 6 Dec 2011 21:01:12 +1100 Message-ID: <4EDDE7E4.1020503@linux.vnet.ibm.com> Date: Tue, 06 Dec 2011 18:01:08 +0800 From: Zhi Hui Li MIME-Version: 1.0 References: <4EDDDB5A.8020102@linux.vnet.ibm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] About the snapshot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: zhihuili@cn.ibm.com, QEMU-devel On 2011年12月06日 17:40, Stefan Hajnoczi wrote: > On Tue, Dec 6, 2011 at 9:07 AM, Zhi Hui Li wrote: >> >> 1) : >> >> for example: >> >> BDRVQcowState *s = bs->opaque; >> >> s->snapshots >> s->nb_snapshots >> >> >> 1:use the command: qemu-img snapshot ./test.qcow2 -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: qemu-system-x86_64 ./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. yes, I understand what you say, but the qemu-img and savevm both call the function of qcow2_snapshot_create, when I use the command qemu-img snapshot ./test.qcow2 -c aa, but the memory of the s->snapshot don't free. > >> 2): >> in the function of >> qcow2_update_snapshot_refcount >> >> it has some " goto fail "; >> if the function runs some times, then something makes it goto fail, >> I am not sure whether it will make the refcount incorrect. > > 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 look. > > Stefan > Ok, I got it. thank you very much !