From patchwork Fri Feb 15 17:46:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 220783 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 D83FA2C007B for ; Sat, 16 Feb 2013 04:47:52 +1100 (EST) Received: from localhost ([::1]:50023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6PO2-0004vx-Ud for incoming@patchwork.ozlabs.org; Fri, 15 Feb 2013 12:47:50 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6PNk-0004ao-4U for qemu-devel@nongnu.org; Fri, 15 Feb 2013 12:47:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6PNc-00047U-G6 for qemu-devel@nongnu.org; Fri, 15 Feb 2013 12:47:32 -0500 Received: from mail-ve0-f179.google.com ([209.85.128.179]:57305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6PNc-00047I-9Y for qemu-devel@nongnu.org; Fri, 15 Feb 2013 12:47:24 -0500 Received: by mail-ve0-f179.google.com with SMTP id da11so3309118veb.10 for ; Fri, 15 Feb 2013 09:47:23 -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=YaS9JV60MTquPaDGW6fUhSuETBYHRGjRCPld1tANGGc=; b=YHfYMB/rYYrvGfgACzC2bgnjHPkkN9QcWIcq4jW3HjKm6ZrJeGlCj9eDuTK0CzpEo9 kVP2R5Rle/voUp21bq5SxqqMyzU1N7uGkSxBISbIbBQ7KWa1Q1PS1DANE4eSrYTmpWQ7 CMGRrgFWRjpRU+M4r9YrmXhh0wHqf+JIObQmwR8reu2+PfF2C8MYnOxUToPm9MUyr77G za4dmPo+6m4hNAzAReLIKSmEBx0S4p0hzaFDrDVbprnp31WnfMlGabelhDaiStPT7OCg JjClj2ZP5SeBxiJLGgylGCg0aEsu39TkSJekNG2jLCfP7zSDeJejU2ifFbiufJ2lIIPu r9Jw== X-Received: by 10.58.117.229 with SMTP id kh5mr4506403veb.27.1360950443801; Fri, 15 Feb 2013 09:47:23 -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.21 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 15 Feb 2013 09:47:22 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2013 18:46:33 +0100 Message-Id: <1360950433-17106-2-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.128.179 Cc: owasserm@redhat.com, chegu_vinod@hp.com, quintela@redhat.com Subject: [Qemu-devel] [PATCH 01/41] migration: simplify while loop 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 Unify the goto around the loop, with the exit condition at the end of it. Both can be expressed as "while (ret >= 0)". Signed-off-by: Paolo Bonzini Reviewed-by: Orit Wasserman Reviewed-by: Juan Quintela --- migration.c | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-) diff --git a/migration.c b/migration.c index b1ebb01..5414060 100644 --- a/migration.c +++ b/migration.c @@ -665,14 +665,9 @@ static void *buffered_file_thread(void *opaque) qemu_mutex_lock_iothread(); DPRINTF("beginning savevm\n"); ret = qemu_savevm_state_begin(s->file, &s->params); - if (ret < 0) { - DPRINTF("failed, %d\n", ret); - qemu_mutex_unlock_iothread(); - goto out; - } qemu_mutex_unlock_iothread(); - while (true) { + while (ret >= 0) { int64_t current_time = qemu_get_clock_ms(rt_clock); uint64_t pending_size; @@ -745,12 +740,8 @@ static void *buffered_file_thread(void *opaque) g_usleep((initial_time + BUFFER_DELAY - current_time)*1000); } ret = buffered_flush(s); - if (ret < 0) { - break; - } } -out: if (ret < 0) { migrate_fd_error(s); }