aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2017-03-21 17:44:30 +0100
committerJuan Quintela <quintela@redhat.com>2017-04-21 12:25:40 +0200
commitb8c4899398126a1dd80377e14d4ba471018293d3 (patch)
tree5a440b00d317c8d2d79ab06846826ee440940a0e
parentf20e2865167d2c147ccb42a445764e1ec99483e0 (diff)
downloadqemu-b8c4899398126a1dd80377e14d4ba471018293d3.zip
qemu-b8c4899398126a1dd80377e14d4ba471018293d3.tar.gz
qemu-b8c4899398126a1dd80377e14d4ba471018293d3.tar.bz2
ram: rename last_ram_offset() last_ram_pages()
We always use it as pages anyways. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-rw-r--r--exec.c6
-rw-r--r--include/exec/ram_addr.h2
-rw-r--r--migration/ram.c11
3 files changed, 9 insertions, 10 deletions
diff --git a/exec.c b/exec.c
index 7a640c7..de843f4 100644
--- a/exec.c
+++ b/exec.c
@@ -1528,7 +1528,7 @@ static ram_addr_t find_ram_offset(ram_addr_t size)
return offset;
}
-ram_addr_t last_ram_offset(void)
+unsigned long last_ram_page(void)
{
RAMBlock *block;
ram_addr_t last = 0;
@@ -1538,7 +1538,7 @@ ram_addr_t last_ram_offset(void)
last = MAX(last, block->offset + block->max_length);
}
rcu_read_unlock();
- return last;
+ return last >> TARGET_PAGE_BITS;
}
static void qemu_ram_setup_dump(void *addr, ram_addr_t size)
@@ -1727,7 +1727,7 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)
ram_addr_t old_ram_size, new_ram_size;
Error *err = NULL;
- old_ram_size = last_ram_offset() >> TARGET_PAGE_BITS;
+ old_ram_size = last_ram_page();
qemu_mutex_lock_ramlist();
new_block->offset = find_ram_offset(new_block->max_length);
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index 8a1372c..a8411c7 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -53,7 +53,7 @@ static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
}
long qemu_getrampagesize(void);
-ram_addr_t last_ram_offset(void);
+unsigned long last_ram_page(void);
RAMBlock *qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,
bool share, const char *mem_path,
Error **errp);
diff --git a/migration/ram.c b/migration/ram.c
index 932a96e..f972882 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1537,7 +1537,7 @@ void migration_bitmap_extend(ram_addr_t old, ram_addr_t new)
*/
void ram_debug_dump_bitmap(unsigned long *todump, bool expected)
{
- int64_t ram_pages = last_ram_offset() >> TARGET_PAGE_BITS;
+ unsigned long ram_pages = last_ram_page();
RAMState *rs = &ram_state;
int64_t cur;
int64_t linelen = 128;
@@ -1904,8 +1904,7 @@ int ram_postcopy_send_discard_bitmap(MigrationState *ms)
* Update the unsentmap to be unsentmap = unsentmap | dirty
*/
bitmap = atomic_rcu_read(&rs->ram_bitmap)->bmap;
- bitmap_or(unsentmap, unsentmap, bitmap,
- last_ram_offset() >> TARGET_PAGE_BITS);
+ bitmap_or(unsentmap, unsentmap, bitmap, last_ram_page());
trace_ram_postcopy_send_discard_bitmap();
@@ -1953,7 +1952,7 @@ err:
static int ram_state_init(RAMState *rs)
{
- int64_t ram_bitmap_pages; /* Size of bitmap in pages, including gaps */
+ unsigned long ram_bitmap_pages;
memset(rs, 0, sizeof(*rs));
qemu_mutex_init(&rs->bitmap_mutex);
@@ -1999,7 +1998,7 @@ static int ram_state_init(RAMState *rs)
rs->ram_bitmap = g_new0(struct RAMBitmap, 1);
/* Skip setting bitmap if there is no RAM */
if (ram_bytes_total()) {
- ram_bitmap_pages = last_ram_offset() >> TARGET_PAGE_BITS;
+ ram_bitmap_pages = last_ram_page();
rs->ram_bitmap->bmap = bitmap_new(ram_bitmap_pages);
bitmap_set(rs->ram_bitmap->bmap, 0, ram_bitmap_pages);
@@ -2460,7 +2459,7 @@ static void decompress_data_with_multi_threads(QEMUFile *f,
*/
int ram_postcopy_incoming_init(MigrationIncomingState *mis)
{
- size_t ram_pages = last_ram_offset() >> TARGET_PAGE_BITS;
+ unsigned long ram_pages = last_ram_page();
return postcopy_ram_incoming_init(mis, ram_pages);
}