[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 8/8] migration: clear the dead code
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v4 8/8] migration: clear the dead code |
Date: |
Thu, 27 Mar 2014 11:18:23 +0800 |
From: ChenLiang <address@hidden>
clear the dead code
Signed-off-by: ChenLiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
---
arch_init.c | 13 -------------
page_cache.c | 58 ----------------------------------------------------------
2 files changed, 71 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 94b62e2..db38c9a 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -164,14 +164,11 @@ static inline bool is_zero_range(uint8_t *p, uint64_t
size)
static struct {
/* buffer used for XBZRLE encoding */
uint8_t *encoded_buf;
- /* buffer for storing page content */
- uint8_t *current_buf;
/* Cache for XBZRLE, Protected by lock. */
PageCache *cache;
QemuMutex lock;
} XBZRLE = {
.encoded_buf = NULL,
- .current_buf = NULL,
.cache = NULL,
};
/* buffer used for XBZRLE decoding */
@@ -723,10 +720,8 @@ static void migration_end(void)
cache_fini(XBZRLE.cache);
g_free(XBZRLE.cache);
g_free(XBZRLE.encoded_buf);
- g_free(XBZRLE.current_buf);
XBZRLE.cache = NULL;
XBZRLE.encoded_buf = NULL;
- XBZRLE.current_buf = NULL;
}
XBZRLE_cache_unlock();
}
@@ -779,14 +774,6 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
return -1;
}
- XBZRLE.current_buf = g_try_malloc(TARGET_PAGE_SIZE);
- if (!XBZRLE.current_buf) {
- DPRINTF("Error allocating current_buf\n");
- g_free(XBZRLE.encoded_buf);
- XBZRLE.encoded_buf = NULL;
- return -1;
- }
-
acct_clear();
}
diff --git a/page_cache.c b/page_cache.c
index 3190c55..7dfa762 100644
--- a/page_cache.c
+++ b/page_cache.c
@@ -48,7 +48,6 @@ struct PageCache {
CacheItem *page_cache;
unsigned int page_size;
int64_t max_num_items;
- uint64_t max_item_age;
int64_t num_items;
};
@@ -76,7 +75,6 @@ PageCache *cache_init(int64_t num_pages, unsigned int
page_size)
}
cache->page_size = page_size;
cache->num_items = 0;
- cache->max_item_age = 0;
cache->max_num_items = num_pages;
DPRINTF("Setting cache buckets to %" PRId64 "\n", cache->max_num_items);
@@ -187,59 +185,3 @@ int cache_insert(PageCache *cache, uint64_t addr, const
uint8_t *pdata,
return 0;
}
-
-int64_t cache_resize(PageCache *cache, int64_t new_num_pages)
-{
- PageCache *new_cache;
- int64_t i;
-
- CacheItem *old_it, *new_it;
-
- g_assert(cache);
-
- /* cache was not inited */
- if (cache->page_cache == NULL) {
- return -1;
- }
-
- /* same size */
- if (pow2floor(new_num_pages) == cache->max_num_items) {
- return cache->max_num_items;
- }
-
- new_cache = cache_init(new_num_pages, cache->page_size);
- if (!(new_cache)) {
- DPRINTF("Error creating new cache\n");
- return -1;
- }
-
- /* move all data from old cache */
- for (i = 0; i < cache->max_num_items; i++) {
- old_it = &cache->page_cache[i];
- if (old_it->it_addr != -1) {
- /* check for collision, if there is, keep MRU page */
- new_it = cache_get_by_addr(new_cache, old_it->it_addr);
- if (new_it->it_data && new_it->it_age >= old_it->it_age) {
- /* keep the MRU page */
- g_free(old_it->it_data);
- } else {
- if (!new_it->it_data) {
- new_cache->num_items++;
- }
- g_free(new_it->it_data);
- new_it->it_data = old_it->it_data;
- new_it->it_age = old_it->it_age;
- new_it->it_addr = old_it->it_addr;
- }
- }
- }
-
- g_free(cache->page_cache);
- cache->page_cache = new_cache->page_cache;
- cache->max_num_items = new_cache->max_num_items;
- cache->num_items = new_cache->num_items;
-
- g_free(new_cache);
-
- return cache->max_num_items;
-}
--
1.7.12.4
- [Qemu-devel] [PATCH v4 0/8] migration: Optimizate the xbzrle and fix one corruption issue, arei.gonglei, 2014/03/26
- [Qemu-devel] [PATCH v4 7/8] migration: optimize xbzrle by reducing data copy, arei.gonglei, 2014/03/26
- [Qemu-devel] [PATCH v4 2/8] migration: Add counts of updating the dirty bitmap, arei.gonglei, 2014/03/26
- [Qemu-devel] [PATCH v4 4/8] migration: expose xbzrle cache miss rate, arei.gonglei, 2014/03/26
- [Qemu-devel] [PATCH v4 8/8] migration: clear the dead code,
arei.gonglei <=
- [Qemu-devel] [PATCH v4 6/8] XBZRLE: rebuild the cache_is_cached function, arei.gonglei, 2014/03/26
- [Qemu-devel] [PATCH v4 3/8] migration: expose the bitmap_sync_count to the end user, arei.gonglei, 2014/03/26
- [Qemu-devel] [PATCH v4 1/8] XBZRLE: Fix one XBZRLE corruption issues, arei.gonglei, 2014/03/26
- [Qemu-devel] [PATCH v4 5/8] XBZRLE: optimize XBZRLE to decrease the cache misses, arei.gonglei, 2014/03/26