From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USzfY-0006I1-Vq for qemu-devel@nongnu.org; Thu, 18 Apr 2013 20:59:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1USzfX-0006w3-Rq for qemu-devel@nongnu.org; Thu, 18 Apr 2013 20:59:16 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:47031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USzfX-0006vu-8U for qemu-devel@nongnu.org; Thu, 18 Apr 2013 20:59:15 -0400 Received: from /spool/local by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 19 Apr 2013 06:23:51 +0530 Received: from d28relay04.in.ibm.com (d28relay04.in.ibm.com [9.184.220.61]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 7C8A0E004A for ; Fri, 19 Apr 2013 06:31:08 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3J0x5hA14811424 for ; Fri, 19 Apr 2013 06:29:05 +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 r3J0x96F018131 for ; Fri, 19 Apr 2013 10:59:09 +1000 From: Wenchao Xia Date: Fri, 19 Apr 2013 08:57:09 +0800 Message-Id: <1366333030-8564-5-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1366333030-8564-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1366333030-8564-1-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH V3 4/5] block: package rollback code in qmp_transaction() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@gmail.com, dietmar@proxmox.com, pbonzini@redhat.com, Wenchao Xia Signed-off-by: Wenchao Xia --- blockdev.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index 275c6f9..051be98 100644 --- a/blockdev.c +++ b/blockdev.c @@ -882,6 +882,13 @@ static void external_snapshot_commit(BlkTransactionStates *states) NULL); } +static void external_snapshot_rollback(BlkTransactionStates *states) +{ + if (states->new_bs) { + bdrv_delete(states->new_bs); + } +} + /* * 'Atomic' group snapshots. The snapshots are taken as a set, and if any fail * then we do not pivot any of the devices in the group, and abandon the @@ -939,9 +946,7 @@ delete_and_fail: * the original bs for all images */ QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) { - if (states->new_bs) { - bdrv_delete(states->new_bs); - } + external_snapshot_rollback(states); } exit: QSIMPLEQ_FOREACH_SAFE(states, &snap_bdrv_states, entry, next) { -- 1.7.1