mirror of https://github.com/xemu-project/xemu.git
exec: Remove unnecessary RAM_FILE flag
The only code that sets RAMBlock.fd is file_ram_alloc(), and the only code that calls file_ram_alloc() sets the RAM_FILE flag. That means the flag is always set when RAMBlock.fd >= 0, and the munmap() call at reclaim_ramblock() is dead code that never runs. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <1446847881-9385-1-git-send-email-ehabkost@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
fc3e7665d7
commit
2f3a2bb15e
10
exec.c
10
exec.c
|
@ -88,9 +88,6 @@ static MemoryRegion io_mem_unassigned;
|
||||||
*/
|
*/
|
||||||
#define RAM_RESIZEABLE (1 << 2)
|
#define RAM_RESIZEABLE (1 << 2)
|
||||||
|
|
||||||
/* RAM is backed by an mmapped file.
|
|
||||||
*/
|
|
||||||
#define RAM_FILE (1 << 3)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
|
struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
|
||||||
|
@ -1601,7 +1598,6 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,
|
||||||
new_block->used_length = size;
|
new_block->used_length = size;
|
||||||
new_block->max_length = size;
|
new_block->max_length = size;
|
||||||
new_block->flags = share ? RAM_SHARED : 0;
|
new_block->flags = share ? RAM_SHARED : 0;
|
||||||
new_block->flags |= RAM_FILE;
|
|
||||||
new_block->host = file_ram_alloc(new_block, size,
|
new_block->host = file_ram_alloc(new_block, size,
|
||||||
mem_path, errp);
|
mem_path, errp);
|
||||||
if (!new_block->host) {
|
if (!new_block->host) {
|
||||||
|
@ -1684,11 +1680,7 @@ static void reclaim_ramblock(RAMBlock *block)
|
||||||
xen_invalidate_map_cache_entry(block->host);
|
xen_invalidate_map_cache_entry(block->host);
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
} else if (block->fd >= 0) {
|
} else if (block->fd >= 0) {
|
||||||
if (block->flags & RAM_FILE) {
|
qemu_ram_munmap(block->host, block->max_length);
|
||||||
qemu_ram_munmap(block->host, block->max_length);
|
|
||||||
} else {
|
|
||||||
munmap(block->host, block->max_length);
|
|
||||||
}
|
|
||||||
close(block->fd);
|
close(block->fd);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue