memory: Fold memory_region_update_topology into memory_region_transaction_commit
Simplify the code as we are using now only a subset of the original features of memory_region_update_topology. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
		
							parent
							
								
									59023ef411
								
							
						
					
					
						commit
						02e2b95fb4
					
				
							
								
								
									
										33
									
								
								memory.c
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								memory.c
									
									
									
									
									
								
							@ -24,7 +24,6 @@
 | 
			
		||||
#include "exec-obsolete.h"
 | 
			
		||||
 | 
			
		||||
unsigned memory_region_transaction_depth = 0;
 | 
			
		||||
static bool memory_region_update_pending = false;
 | 
			
		||||
static bool global_dirty_log = false;
 | 
			
		||||
 | 
			
		||||
static QTAILQ_HEAD(memory_listeners, MemoryListener) memory_listeners
 | 
			
		||||
@ -732,17 +731,16 @@ static void address_space_update_topology(AddressSpace *as)
 | 
			
		||||
    address_space_update_ioeventfds(as);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void memory_region_update_topology(MemoryRegion *mr)
 | 
			
		||||
void memory_region_transaction_begin(void)
 | 
			
		||||
{
 | 
			
		||||
    if (memory_region_transaction_depth) {
 | 
			
		||||
        memory_region_update_pending |= !mr || mr->enabled;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (mr && !mr->enabled) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    ++memory_region_transaction_depth;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void memory_region_transaction_commit(void)
 | 
			
		||||
{
 | 
			
		||||
    assert(memory_region_transaction_depth);
 | 
			
		||||
    --memory_region_transaction_depth;
 | 
			
		||||
    if (!memory_region_transaction_depth) {
 | 
			
		||||
        MEMORY_LISTENER_CALL_GLOBAL(begin, Forward);
 | 
			
		||||
 | 
			
		||||
        if (address_space_memory.root) {
 | 
			
		||||
@ -753,21 +751,6 @@ static void memory_region_update_topology(MemoryRegion *mr)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        MEMORY_LISTENER_CALL_GLOBAL(commit, Forward);
 | 
			
		||||
 | 
			
		||||
    memory_region_update_pending = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void memory_region_transaction_begin(void)
 | 
			
		||||
{
 | 
			
		||||
    ++memory_region_transaction_depth;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void memory_region_transaction_commit(void)
 | 
			
		||||
{
 | 
			
		||||
    assert(memory_region_transaction_depth);
 | 
			
		||||
    --memory_region_transaction_depth;
 | 
			
		||||
    if (!memory_region_transaction_depth && memory_region_update_pending) {
 | 
			
		||||
        memory_region_update_topology(NULL);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user