From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uh9WU-0005Oi-Ay for qemu-devel@nongnu.org; Mon, 27 May 2013 22:20:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uh9WS-000152-EZ for qemu-devel@nongnu.org; Mon, 27 May 2013 22:20:26 -0400 Received: from e28smtp01.in.ibm.com ([122.248.162.1]:43742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uh9WR-00014t-Pn for qemu-devel@nongnu.org; Mon, 27 May 2013 22:20:24 -0400 Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 28 May 2013 07:44:18 +0530 Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 0079A394004E for ; Tue, 28 May 2013 07:50:20 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r4S2KBsu8520014 for ; Tue, 28 May 2013 07:50:13 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r4S2KF3t008311 for ; Tue, 28 May 2013 12:20:16 +1000 Message-ID: <51A4145C.8040908@linux.vnet.ibm.com> Date: Tue, 28 May 2013 10:20:12 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1369451385-23452-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1369451385-23452-2-git-send-email-xiawenc@linux.vnet.ibm.com> <20130527151852.GE2373@dhcp-200-207.str.redhat.com> In-Reply-To: <20130527151852.GE2373@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH V3 1/4] block: drop bs_snapshots global variable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: phrdina@redhat.com, stefanha@gmail.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, Stefan Hajnoczi , pbonzini@redhat.com, armbru@redhat.com 于 2013-5-27 23:18, Kevin Wolf 写道: > Am 25.05.2013 um 05:09 hat Wenchao Xia geschrieben: >> From: Stefan Hajnoczi >> >> The bs_snapshots global variable points to the BlockDriverState which >> will be used to save vmstate. This is really a savevm.c concept but was >> moved into block.c:bdrv_snapshots() when it became clear that hotplug >> could result in a dangling pointer. >> >> While auditing the block layer's global state I came upon bs_snapshots >> and realized that a variable is not necessary here. Simply find the >> first BlockDriverState capable of internal snapshots each time this is >> needed. >> >> The behavior of bdrv_snapshots() is preserved across hotplug because new >> drives are always appended to the bdrv_states list. This means that >> calling the new find_vmstate_bs() function is idempotent - it returns >> the same BlockDriverState unless it was hot-unplugged. >> >> Signed-off-by: Stefan Hajnoczi >> Reviewed-by: Eric Blake >> Reviewed-by: Wenchao Xia >> Signed-off-by: Wenchao Xia > > I am not totally convinced by this approach, especially when it's nowhere > documented that the order of BDSes in the list is important. However, I > think the current code is suboptimal as well, so I'll apply this for > now. > > What we really want is this: savevm lets you choose which image to save > the VM state to, and if you don't specify one, it automatically picks > one like today. loadvm checks all images and loads the VM state from the > image that has the VM state for this snapshot. If loadvm finds that it's > not exactly one image that has a VM state, this is an error condition. > > Is anyone interested in implementing this? > > Kevin > I think that can came up after Pavel's savevm transaction, which add parameter telling which image to save vmstate. This patch simply keep what it is now not touching that part. -- Best Regards Wenchao Xia