From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVjjE-0003mL-DW for qemu-devel@nongnu.org; Fri, 26 Apr 2013 10:34:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVjjC-00030W-B6 for qemu-devel@nongnu.org; Fri, 26 Apr 2013 10:34:24 -0400 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:54917) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVjjC-0002yC-4W for qemu-devel@nongnu.org; Fri, 26 Apr 2013 10:34:22 -0400 Received: by mail-we0-f179.google.com with SMTP id u3so3616230wey.24 for ; Fri, 26 Apr 2013 07:34:21 -0700 (PDT) Date: Fri, 26 Apr 2013 16:34:18 +0200 From: Stefan Hajnoczi Message-ID: <20130426143418.GA7648@stefanha-thinkpad.redhat.com> References: <1366968675-1451-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1366968675-1451-5-git-send-email-xiawenc@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1366968675-1451-5-git-send-email-xiawenc@linux.vnet.ibm.com> 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: Wenchao Xia Cc: kwolf@redhat.com, phrdina@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, pbonzini@redhat.com 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. > 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. Please include a justification for breaking the search order.