From patchwork Wed Feb 23 21:47:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 84270 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 321E9B70CD for ; Thu, 24 Feb 2011 10:22:00 +1100 (EST) Received: from localhost ([127.0.0.1]:38082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsNHj-0007gh-Bg for incoming@patchwork.ozlabs.org; Wed, 23 Feb 2011 17:34:15 -0500 Received: from [140.186.70.92] (port=35638 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsMZB-0000Pb-7N for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsMZ8-0005Es-AT for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsMZ7-0005Ed-Rp for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:10 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1NLm9lU028026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 23 Feb 2011 16:48:09 -0500 Received: from trasno.mitica (ovpn-113-97.phx2.redhat.com [10.3.113.97]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1NLlhCB020923; Wed, 23 Feb 2011 16:48:08 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 23 Feb 2011 22:47:28 +0100 Message-Id: <4cbc825787599c0099d71c3b57adb612648d4d0d.1298492768.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 19/28] migration: Use bandwidth_limit directly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now that current_migration is static, there is no reason for max_throotle variable. Signed-off-by: Juan Quintela --- migration.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/migration.c b/migration.c index f8c6d09..49cdf72 100644 --- a/migration.c +++ b/migration.c @@ -31,11 +31,11 @@ do { } while (0) #endif -/* Migration speed throttling */ -static int64_t max_throttle = (32 << 20); +#define MAX_THROTTLE (32 << 20) /* Migration speed throttling */ static MigrationState current_migration = { .state = MIG_STATE_NONE, + .bandwidth_limit = MAX_THROTTLE, }; static NotifierList migration_state_notifiers = @@ -369,13 +369,11 @@ void migrate_fd_connect(MigrationState *s) migrate_fd_put_ready(s); } -static void migrate_init_state(Monitor *mon, int64_t bandwidth_limit, - int detach, int blk, int inc) +static void migrate_init_state(Monitor *mon, int detach, int blk, int inc) { current_migration.blk = blk; current_migration.shared = inc; current_migration.mon = NULL; - current_migration.bandwidth_limit = bandwidth_limit; current_migration.state = MIG_STATE_NONE; if (!detach) { @@ -401,7 +399,7 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) return -1; } - migrate_init_state(mon, max_throttle, detach, blk, inc); + migrate_init_state(mon, detach, blk, inc); if (strstart(uri, "tcp:", &p)) { ret = tcp_start_outgoing_migration(¤t_migration, p); @@ -441,9 +439,10 @@ int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data) if (d < 0) { d = 0; } - max_throttle = d; + current_migration.bandwidth_limit = d; - qemu_file_set_rate_limit(current_migration.file, max_throttle); + qemu_file_set_rate_limit(current_migration.file, + current_migration.bandwidth_limit); return 0; }