From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVvvn-0005WA-H6 for qemu-devel@nongnu.org; Fri, 26 Apr 2013 23:36:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVvvl-0005Ro-Ez for qemu-devel@nongnu.org; Fri, 26 Apr 2013 23:36:11 -0400 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:47762) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVvvk-0005Rd-Tl for qemu-devel@nongnu.org; Fri, 26 Apr 2013 23:36:09 -0400 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 27 Apr 2013 13:30:02 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 5F4E92BB0051 for ; Sat, 27 Apr 2013 13:35:59 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3R3MBqQ20709454 for ; Sat, 27 Apr 2013 13:22:12 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r3R3Zvi9013313 for ; Sat, 27 Apr 2013 13:35:58 +1000 Message-ID: <517B4743.4000508@linux.vnet.ibm.com> Date: Sat, 27 Apr 2013 11:34:27 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1366968675-1451-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1366968675-1451-5-git-send-email-xiawenc@linux.vnet.ibm.com> <20130426143418.GA7648@stefanha-thinkpad.redhat.com> In-Reply-To: <20130426143418.GA7648@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 4/7] block: distinguish id and name in bdrv_find_snapshot() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, phrdina@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, lcapitulino@redhat.com, pbonzini@redhat.com 于 2013-4-26 22:34, Stefan Hajnoczi 写道: > On Fri, Apr 26, 2013 at 05:31:12PM +0800, Wenchao Xia wrote: >> To make it clear about id and name in searching, the API is changed >> a bit to distinguish them, and caller can choose to search by id or name. >> If not found, *errp will be set to tip why. >> >> Note that the caller logic is changed a bit: >> 1) In del_existing_snapshots() called by do_savevm(), it travers twice > > s/travers/traverse/ > > Also in comments in the code. > OK. >> to find the snapshot, instead once, so matching sequence may change >> if there are unwisely chosen, mixed id and names. >> 2) In do_savevm(), same with del_existing_snapshot(), when it tries to >> find the snapshot to overwrite, matching sequence may change for same >> reason. >> 3) In load_vmstate(), first when it tries to find the snapshot to be loaded, >> sequence may change for the same reason of above. Later in validation, the >> logic is changed to be more strict to require both id and name matching. >> 4) In do_info_snapshot(), in validation, the logic is changed to be more >> strict to require both id and name matching. > > It's easy to avoid changing semantics: keep the old name or id behavior > around. Use the new name-and-id behavior for #3 and #4. You mean adding a new function, instead of change bdrv_find_snapshot()? > > Please include a justification for breaking the search order. > -- Best Regards Wenchao Xia