Commit 631da97d authored by marko's avatar marko

branches/zip: Fix two bugs in the buddy allocator.

buf_buddy_block_free(): Remove the block from buf_pool->zip_hash.

buf_buddy_alloc_clean(): Test for buf_page_in_file() before
invoking buf_LRU_free_block().  The LRU list also contains "half-freed"
blocks (state == BUF_BLOCK_REMOVE_HASH).
parent 9244a3a5
...@@ -87,6 +87,8 @@ buf_buddy_block_free( ...@@ -87,6 +87,8 @@ buf_buddy_block_free(
((buf_block_t*) bpage)->frame == buf); ((buf_block_t*) bpage)->frame == buf);
ut_a(bpage); ut_a(bpage);
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_MEMORY); ut_a(buf_page_get_state(bpage) == BUF_BLOCK_MEMORY);
HASH_DELETE(buf_page_t, hash, buf_pool->zip_hash, fold, bpage);
ut_d(memset(buf, 0, UNIV_PAGE_SIZE)); ut_d(memset(buf, 0, UNIV_PAGE_SIZE));
block = (buf_block_t*) bpage; block = (buf_block_t*) bpage;
...@@ -215,6 +217,13 @@ buf_buddy_alloc_clean( ...@@ -215,6 +217,13 @@ buf_buddy_alloc_clean(
void* ret; void* ret;
mutex_t* block_mutex = buf_page_get_mutex(bpage); mutex_t* block_mutex = buf_page_get_mutex(bpage);
if (!buf_page_in_file(bpage)) {
/* This is most likely BUF_BLOCK_REMOVE_HASH,
that is, the block is already being freed. */
continue;
}
mutex_enter(block_mutex); mutex_enter(block_mutex);
/* Keep the compressed pages of uncompressed blocks. */ /* Keep the compressed pages of uncompressed blocks. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment