Commit bb9217fa authored by marko's avatar marko

branches/zip: Before calling buf_buddy_alloc() or buf_buddy_free(),

release any block mutexes but hold the buf_pool->mutex.
parent f890ec15
...@@ -1943,6 +1943,8 @@ buf_page_init( ...@@ -1943,6 +1943,8 @@ buf_page_init(
(ulong) space, (ulong) space,
(ulong) offset); (ulong) offset);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
mutex_exit(&block->mutex);
mutex_exit(&buf_pool->mutex);
buf_print(); buf_print();
buf_LRU_print(); buf_LRU_print();
buf_validate(); buf_validate();
...@@ -2133,13 +2135,11 @@ buf_page_init_for_read( ...@@ -2133,13 +2135,11 @@ buf_page_init_for_read(
} }
} }
bpage->zip.data = NULL; mutex_exit(&block->mutex);
page_zip_set_size(&bpage->zip, 0); mutex_exit(&buf_pool->zip_mutex);
buf_buddy_free(bpage, sizeof *bpage); buf_buddy_free(bpage, sizeof *bpage);
mutex_exit(&block->mutex);
mutex_exit(&buf_pool->zip_mutex);
mutex_exit(&buf_pool->mutex); mutex_exit(&buf_pool->mutex);
if (mode == BUF_READ_IBUF_PAGES_ONLY) { if (mode == BUF_READ_IBUF_PAGES_ONLY) {
...@@ -2182,8 +2182,12 @@ err_exit: ...@@ -2182,8 +2182,12 @@ err_exit:
ut_ad(block); ut_ad(block);
if (zip_size) { if (zip_size) {
void* data;
page_zip_set_size(&block->page.zip, zip_size); page_zip_set_size(&block->page.zip, zip_size);
block->page.zip.data = buf_buddy_alloc(zip_size, TRUE); mutex_exit(&block->mutex);
data = buf_buddy_alloc(zip_size, TRUE);
mutex_enter(&block->mutex);
block->page.zip.data = data;
} }
buf_page_init(space, offset, block); buf_page_init(space, offset, block);
......
...@@ -916,7 +916,6 @@ buf_LRU_free_block( ...@@ -916,7 +916,6 @@ buf_LRU_free_block(
ut_a(bpage->buf_fix_count == 0); ut_a(bpage->buf_fix_count == 0);
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
mutex_enter(block_mutex);
if (bpage->zip.data) { if (bpage->zip.data) {
/* Keep the compressed page. /* Keep the compressed page.
...@@ -939,11 +938,17 @@ buf_LRU_free_block( ...@@ -939,11 +938,17 @@ buf_LRU_free_block(
buf_LRU_insert_zip_clean(b); buf_LRU_insert_zip_clean(b);
mutex_enter(block_mutex);
bpage->zip.data = NULL; bpage->zip.data = NULL;
page_zip_set_size(&bpage->zip, 0); page_zip_set_size(&bpage->zip, 0);
goto free_hashed;
} }
} }
mutex_enter(block_mutex);
free_hashed:
buf_LRU_block_free_hashed_page((buf_block_t*) bpage); buf_LRU_block_free_hashed_page((buf_block_t*) bpage);
} else { } else {
mutex_enter(block_mutex); mutex_enter(block_mutex);
...@@ -992,7 +997,9 @@ buf_LRU_block_free_non_file_page( ...@@ -992,7 +997,9 @@ buf_LRU_block_free_non_file_page(
if (data) { if (data) {
block->page.zip.data = NULL; block->page.zip.data = NULL;
mutex_exit(&block->mutex);
buf_buddy_free(data, page_zip_get_size(&block->page.zip)); buf_buddy_free(data, page_zip_get_size(&block->page.zip));
mutex_enter(&block->mutex);
page_zip_set_size(&block->page.zip, 0); page_zip_set_size(&block->page.zip, 0);
} }
...@@ -1111,7 +1118,9 @@ buf_LRU_block_remove_hashed_page( ...@@ -1111,7 +1118,9 @@ buf_LRU_block_remove_hashed_page(
void* data = bpage->zip.data; void* data = bpage->zip.data;
bpage->zip.data = NULL; bpage->zip.data = NULL;
mutex_exit(&((buf_block_t*) bpage)->mutex);
buf_buddy_free(data, page_zip_get_size(&bpage->zip)); buf_buddy_free(data, page_zip_get_size(&bpage->zip));
mutex_enter(&((buf_block_t*) bpage)->mutex);
page_zip_set_size(&bpage->zip, 0); page_zip_set_size(&bpage->zip, 0);
} }
......
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