Commit 82ce6462 authored by marko's avatar marko

branches/zip: buf_buddy_free_low(): Examine the state bits inside the

block before traversing the free list.
parent 88c6f95b
...@@ -413,6 +413,15 @@ buf_buddy_free_low( ...@@ -413,6 +413,15 @@ buf_buddy_free_low(
buddy = (buf_page_t*) buf_buddy_get(((byte*) buf), BUF_BUDDY_LOW << i); buddy = (buf_page_t*) buf_buddy_get(((byte*) buf), BUF_BUDDY_LOW << i);
if (buddy->state != BUF_BLOCK_ZIP_FREE) {
goto buddy_nonfree;
}
/* The field buddy->state can only be trusted for free blocks.
If buddy->state == BUF_BLOCK_ZIP_FREE, the block is free if
it is in the free list. */
for (bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]); for (bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]);
bpage; bpage = UT_LIST_GET_NEXT(list, bpage)) { bpage; bpage = UT_LIST_GET_NEXT(list, bpage)) {
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE); ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE);
...@@ -436,6 +445,7 @@ buf_buddy_free_low( ...@@ -436,6 +445,7 @@ buf_buddy_free_low(
ut_a(bpage != buf); ut_a(bpage != buf);
} }
buddy_nonfree:
/* The buddy is not free. Is there a free block of this size? */ /* The buddy is not free. Is there a free block of this size? */
bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]); bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]);
......
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