From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFA2n-0003t2-0k for qemu-devel@nongnu.org; Mon, 30 Nov 2009 12:28:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFA2c-0003jN-27 for qemu-devel@nongnu.org; Mon, 30 Nov 2009 12:28:04 -0500 Received: from [199.232.76.173] (port=36087 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFA2Y-0003iL-8N for qemu-devel@nongnu.org; Mon, 30 Nov 2009 12:27:58 -0500 Received: from david.siemens.de ([192.35.17.14]:22234) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NFA2X-0004gE-7K for qemu-devel@nongnu.org; Mon, 30 Nov 2009 12:27:57 -0500 Resent-To: Anthony Liguori Resent-Message-Id: <4B140096.8050103@siemens.com> From: Jan Kiszka Date: Mon, 30 Nov 2009 18:21:20 +0100 Message-ID: <20091130172120.22889.64304.stgit@mchn012c.ww002.siemens.net> In-Reply-To: <20091130172119.22889.28114.stgit@mchn012c.ww002.siemens.net> References: <20091130172119.22889.28114.stgit@mchn012c.ww002.siemens.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 12/23] block migration: Clean up use of total_sectors List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org, Liran Schour , Pierre Riteau We already save total_sectors in BlkMigDevState, let's use this value during the migration and avoid to recalculate it needlessly. Signed-off-by: Jan Kiszka --- block-migration.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block-migration.c b/block-migration.c index ec32ee2..2f89a4e 100644 --- a/block-migration.c +++ b/block-migration.c @@ -96,10 +96,10 @@ static int mig_read_device_bulk(QEMUFile *f, BlkMigDevState *bms) blk->buf = qemu_malloc(BLOCK_SIZE); cur_sector = bms->cur_sector; - total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS; + total_sectors = bms->total_sectors; if (bms->shared_base) { - while (cur_sector < bms->total_sectors && + while (cur_sector < total_sectors && !bdrv_is_allocated(bms->bs, cur_sector, MAX_IS_ALLOCATED_SEARCH, &nr_sectors)) { cur_sector += nr_sectors; @@ -165,7 +165,7 @@ static int mig_save_device_bulk(QEMUFile *f, BlkMigDevState *bmds) cur_sector = bmds->cur_sector; if (bmds->shared_base) { - while (cur_sector < bmds->total_sectors && + while (cur_sector < total_sectors && !bdrv_is_allocated(bmds->bs, cur_sector, MAX_IS_ALLOCATED_SEARCH, &nr_sectors)) { cur_sector += nr_sectors;