[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 11/41] arch_init: factor out counting transferred
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH v2 11/41] arch_init: factor out counting transferred bytes |
Date: |
Mon, 4 Jun 2012 18:57:13 +0900 |
Signed-off-by: Isaku Yamahata <address@hidden>
---
arch_init.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 73bf250..2617478 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -155,8 +155,9 @@ static int is_dup_page(uint8_t *page)
}
static RAMBlock *last_block_sent = NULL;
+static uint64_t bytes_transferred;
-int ram_save_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset)
+static int ram_save_page_int(QEMUFile *f, RAMBlock *block, ram_addr_t offset)
{
MemoryRegion *mr = block->mr;
uint8_t *p;
@@ -192,6 +193,13 @@ int ram_save_page(QEMUFile *f, RAMBlock *block, ram_addr_t
offset)
return TARGET_PAGE_SIZE;
}
+int ram_save_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset)
+{
+ int bytes_sent = ram_save_page_int(f, block, offset);
+ bytes_transferred += bytes_sent;
+ return bytes_sent;
+}
+
static RAMBlock *last_block;
static ram_addr_t last_offset;
@@ -228,8 +236,6 @@ int ram_save_block(QEMUFile *f)
return bytes_sent;
}
-static uint64_t bytes_transferred;
-
static ram_addr_t ram_save_remaining(void)
{
RAMBlock *block;
@@ -357,11 +363,7 @@ int ram_save_live(QEMUFile *f, int stage, void *opaque)
bwidth = qemu_get_clock_ns(rt_clock);
while ((ret = qemu_file_rate_limit(f)) == 0) {
- int bytes_sent;
-
- bytes_sent = ram_save_block(f);
- bytes_transferred += bytes_sent;
- if (bytes_sent == 0) { /* no more blocks */
+ if (ram_save_block(f) == 0) { /* no more blocks */
break;
}
}
@@ -381,11 +383,9 @@ int ram_save_live(QEMUFile *f, int stage, void *opaque)
/* try transferring iterative blocks of memory */
if (stage == 3) {
- int bytes_sent;
-
/* flush all remaining blocks regardless of rate limiting */
- while ((bytes_sent = ram_save_block(f)) != 0) {
- bytes_transferred += bytes_sent;
+ while (ram_save_block(f) != 0) {
+ /* nothing */
}
memory_global_dirty_log_stop();
}
--
1.7.1.1
- [Qemu-devel] [PATCH v2 01/41] arch_init: export sort_ram_list() and ram_save_block(), (continued)
- [Qemu-devel] [PATCH v2 01/41] arch_init: export sort_ram_list() and ram_save_block(), Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 18/41] QEMUFile: add qemu_file_fd() for later use, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 24/41] migration: export migrate_fd_completed() and migrate_fd_cleanup(), Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 05/41] arch_init/ram_save_live: factor out RAM_SAVE_FLAG_MEM_SIZE case, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 31/41] configure: add CONFIG_POSTCOPY option, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 22/41] savevm/QEMUFile: introduce qemu_fopen_fd, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 09/41] arch_init: introduce helper function to find ram block with id string, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 02/41] arch_init: export RAM_SAVE_xxx flags for postcopy, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 13/41] exec.c: factor out qemu_get_ram_ptr(), Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 21/41] savevm: rename QEMUFileSocket to QEMUFileFD, socket_close to fd_close, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 11/41] arch_init: factor out counting transferred bytes,
Isaku Yamahata <=
- [Qemu-devel] [PATCH v2 27/41] buffered_file: Introduce QEMUFileNonblock for nonblock write, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 07/41] arch_init/ram_save_live: factor out ram_save_limit, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 23/41] migration.c: remove redundant line in migrate_init(), Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 29/41] umem.h: import Linux umem.h, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 19/41] savevm/QEMUFile: drop qemu_stdio_fd, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 32/41] savevm: add new section that is used by postcopy, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 15/41] savevm: export qemu_peek_buffer, qemu_peek_byte, qemu_file_skip, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 25/41] migration: factor out parameters into MigrationParams, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 30/41] update-linux-headers.sh: teach umem.h to update-linux-headers.sh, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 38/41] postcopy/outgoing: add forward, backward option to specify the size of prefault, Isaku Yamahata, 2012/06/04