From patchwork Fri Feb 15 17:46:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 220806 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 02D5A2C007C for ; Sat, 16 Feb 2013 05:52:53 +1100 (EST) Received: from localhost ([::1]:52783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6POZ-0006bq-JI for incoming@patchwork.ozlabs.org; Fri, 15 Feb 2013 12:48:23 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6PNv-00058i-5o for qemu-devel@nongnu.org; Fri, 15 Feb 2013 12:47:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6PNm-0004BJ-SF for qemu-devel@nongnu.org; Fri, 15 Feb 2013 12:47:43 -0500 Received: from mail-vc0-f180.google.com ([209.85.220.180]:55354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6PNm-0004B2-LT for qemu-devel@nongnu.org; Fri, 15 Feb 2013 12:47:34 -0500 Received: by mail-vc0-f180.google.com with SMTP id fo13so2279368vcb.25 for ; Fri, 15 Feb 2013 09:47:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=3OJZxi4NvGd5BfZnvZ3WJj8s9xBhgoP7AiAlfXqpEoo=; b=jVsT2EbeU9oEFiOvw5zKG6fpt+t7w/wQBQS92sI7EKK4kkKicmYqQjD0xkqz1VFPrP VB2anEX8lAvsN/gzB5aQ+6yT9/7QrubIPUoA56vMJRJt2Q471o/GadXAkLbpT48hThw7 zOYiQlJub6Fll+vZ+IbRb90ZhyYPCdO4foOY9WsfuFqf5ryQQGcV9L06GPi9hLjblFMe hbqMb1LuhhKK2QYMcabpb8DpsbTHT1gjFfld75S5usNy7muGObbgw/p+JAMN3xdDCaDQ WFnTWJIs8INWFZ1xPbYOUPCv4ZC5KpW6WYMVvzKiSSVU0Cx+X6oXFKI20KrmhduiVWmG QMyg== X-Received: by 10.52.92.199 with SMTP id co7mr3803419vdb.82.1360950452433; Fri, 15 Feb 2013 09:47:32 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-179-137.ip50.fastwebnet.it. [93.34.179.137]) by mx.google.com with ESMTPS id yu12sm65402142vec.6.2013.02.15.09.47.30 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 15 Feb 2013 09:47:31 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2013 18:46:37 +0100 Message-Id: <1360950433-17106-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1360950433-17106-1-git-send-email-pbonzini@redhat.com> References: <1360950433-17106-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.180 Cc: owasserm@redhat.com, chegu_vinod@hp.com, quintela@redhat.com Subject: [Qemu-devel] [PATCH 05/41] block-migration: remove useless calls to blk_mig_cleanup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now that the cancel callback is called consistently for all errors, we can avoid doing its work in the other callbacks. Signed-off-by: Paolo Bonzini Reviewed-by: Orit Wasserman Reviewed-by: Juan Quintela --- block-migration.c | 26 ++++++++------------------ 1 files changed, 8 insertions(+), 18 deletions(-) diff --git a/block-migration.c b/block-migration.c index 43ab202..e6c917d 100644 --- a/block-migration.c +++ b/block-migration.c @@ -524,16 +524,10 @@ static int block_save_setup(QEMUFile *f, void *opaque) set_dirty_tracking(1); ret = flush_blks(f); - if (ret) { - blk_mig_cleanup(); - return ret; - } - blk_mig_reset_dirty_cursor(); - qemu_put_be64(f, BLK_MIG_FLAG_EOS); - return 0; + return ret; } static int block_save_iterate(QEMUFile *f, void *opaque) @@ -546,7 +540,6 @@ static int block_save_iterate(QEMUFile *f, void *opaque) ret = flush_blks(f); if (ret) { - blk_mig_cleanup(); return ret; } @@ -564,20 +557,18 @@ static int block_save_iterate(QEMUFile *f, void *opaque) } } else { ret = blk_mig_save_dirty_block(f, 1); + if (ret < 0) { + return ret; + } if (ret != 0) { /* no more dirty blocks */ break; } } } - if (ret < 0) { - blk_mig_cleanup(); - return ret; - } ret = flush_blks(f); if (ret) { - blk_mig_cleanup(); return ret; } @@ -595,7 +586,6 @@ static int block_save_complete(QEMUFile *f, void *opaque) ret = flush_blks(f); if (ret) { - blk_mig_cleanup(); return ret; } @@ -607,12 +597,11 @@ static int block_save_complete(QEMUFile *f, void *opaque) do { ret = blk_mig_save_dirty_block(f, 0); + if (ret < 0) { + return ret; + } } while (ret == 0); - blk_mig_cleanup(); - if (ret < 0) { - return ret; - } /* report completion */ qemu_put_be64(f, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); @@ -620,6 +609,7 @@ static int block_save_complete(QEMUFile *f, void *opaque) qemu_put_be64(f, BLK_MIG_FLAG_EOS); + blk_mig_cleanup(); return 0; }