From patchwork Fri Feb 22 16:36:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 222555 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 248862C0297 for ; Sat, 23 Feb 2013 03:37:18 +1100 (EST) Received: from localhost ([::1]:52091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8vca-0003b5-8B for incoming@patchwork.ozlabs.org; Fri, 22 Feb 2013 11:37:16 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8vcM-0003WH-Pu for qemu-devel@nongnu.org; Fri, 22 Feb 2013 11:37:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8vcL-0006cG-0G for qemu-devel@nongnu.org; Fri, 22 Feb 2013 11:37:02 -0500 Received: from mail-vc0-f170.google.com ([209.85.220.170]:45605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8vcK-0006bT-Re for qemu-devel@nongnu.org; Fri, 22 Feb 2013 11:37:00 -0500 Received: by mail-vc0-f170.google.com with SMTP id p16so527125vcq.1 for ; Fri, 22 Feb 2013 08:37:00 -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=Fw9la1AkPh27muzHCCvmM8gth61mlsDMfGmlcl9Syp4=; b=xmPSEvJHaH4GP1nE0Ybn3n6jwhcowRymXlUYenTs0ZLK7QAgSTVqKOmzEMFQ68eqAV APqiM+tHp21eTLnHzgh0BLFkkx+NUIH39IkMFOl7uIFq1belBmSjosNDBQv8okR61olV D374xcDx/Yl9pGeExLrGWrw1NgtU1pSgZ+sT3R7w7p/bEsAPDcyB3rlRI+F7ZVzrWi4d AiwkDnuRZmjSESCu5kmwlvzGji5bIHdTCJXnAHOzO6LRkCqqeg8Ro7NQ+2o5YrOqR87W w9aaQiIj1Ru3MIfjL6sngwqnos3TckitAO/8A8xAzgbklFU2U/gVysjC5/LyjXGTtzde QsAw== X-Received: by 10.52.175.130 with SMTP id ca2mr2997775vdc.109.1361551020288; Fri, 22 Feb 2013 08:37:00 -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 tp10sm4291733vec.1.2013.02.22.08.36.58 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 Feb 2013 08:36:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 22 Feb 2013 17:36:07 +0100 Message-Id: <1361551008-12430-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1361551008-12430-1-git-send-email-pbonzini@redhat.com> References: <1361551008-12430-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.170 Cc: owasserm@redhat.com, quintela@redhat.com Subject: [Qemu-devel] [PATCH 01/42] 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 --- migration.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/migration.c b/migration.c index 11725ae..ba8b647 100644 --- a/migration.c +++ b/migration.c @@ -666,14 +666,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; uint64_t pending_size; @@ -754,12 +749,8 @@ static void *buffered_file_thread(void *opaque) sleep_time += qemu_get_clock_ms(rt_clock) - current_time; } ret = buffered_flush(s); - if (ret < 0) { - break; - } } -out: if (ret < 0) { migrate_fd_error(s); }