mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
Merge remote-tracking branch 'quintela/migration-next-20120808' into staging
* quintela/migration-next-20120808: Restart optimization on stage3 update version Add XBZRLE statistics Add migration accounting for normal and duplicate pages Change total_time to total-time in MigrationStats Add migrate_set_cache_size command Add XBZRLE to ram_save_block and ram_save_live Add xbzrle_encode_buffer and xbzrle_decode_buffer functions Add uleb encoding/decoding functions Add cache handling functions Add XBZRLE documentation Add migrate-set-capabilities Add migration capabilities
This commit is contained in:
commit
ac839ccd8c
16 changed files with 1451 additions and 13 deletions
79
include/qemu/page_cache.h
Normal file
79
include/qemu/page_cache.h
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Page cache for QEMU
|
||||
* The cache is base on a hash of the page address
|
||||
*
|
||||
* Copyright 2012 Red Hat, Inc. and/or its affiliates
|
||||
*
|
||||
* Authors:
|
||||
* Orit Wasserman <owasserm@redhat.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PAGE_CACHE_H
|
||||
#define PAGE_CACHE_H
|
||||
|
||||
/* Page cache for storing guest pages */
|
||||
typedef struct PageCache PageCache;
|
||||
|
||||
/**
|
||||
* cache_init: Initialize the page cache
|
||||
*
|
||||
*
|
||||
* Returns new allocated cache or NULL on error
|
||||
*
|
||||
* @cache pointer to the PageCache struct
|
||||
* @num_pages: cache maximal number of cached pages
|
||||
* @page_size: cache page size
|
||||
*/
|
||||
PageCache *cache_init(int64_t num_pages, unsigned int page_size);
|
||||
|
||||
/**
|
||||
* cache_fini: free all cache resources
|
||||
* @cache pointer to the PageCache struct
|
||||
*/
|
||||
void cache_fini(PageCache *cache);
|
||||
|
||||
/**
|
||||
* cache_is_cached: Checks to see if the page is cached
|
||||
*
|
||||
* Returns %true if page is cached
|
||||
*
|
||||
* @cache pointer to the PageCache struct
|
||||
* @addr: page addr
|
||||
*/
|
||||
bool cache_is_cached(const PageCache *cache, uint64_t addr);
|
||||
|
||||
/**
|
||||
* get_cached_data: Get the data cached for an addr
|
||||
*
|
||||
* Returns pointer to the data cached or NULL if not cached
|
||||
*
|
||||
* @cache pointer to the PageCache struct
|
||||
* @addr: page addr
|
||||
*/
|
||||
uint8_t *get_cached_data(const PageCache *cache, uint64_t addr);
|
||||
|
||||
/**
|
||||
* cache_insert: insert the page into the cache. the previous value will be overwritten
|
||||
*
|
||||
* @cache pointer to the PageCache struct
|
||||
* @addr: page address
|
||||
* @pdata: pointer to the page
|
||||
*/
|
||||
void cache_insert(PageCache *cache, uint64_t addr, uint8_t *pdata);
|
||||
|
||||
/**
|
||||
* cache_resize: resize the page cache. In case of size reduction the extra
|
||||
* pages will be freed
|
||||
*
|
||||
* Returns -1 on error new cache size on success
|
||||
*
|
||||
* @cache pointer to the PageCache struct
|
||||
* @num_pages: new page cache size (in pages)
|
||||
*/
|
||||
int64_t cache_resize(PageCache *cache, int64_t num_pages);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue