qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 12/23] block migration: Clean up use of total_sector


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH 12/23] block migration: Clean up use of total_sectors
Date: Mon, 30 Nov 2009 18:21:20 +0100
User-agent: StGIT/0.14.3

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 <address@hidden>
---

 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;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]