Commit 17127565 authored by marko's avatar marko

branches/zip: buf0lru.c: Minor cleanup.

Use ut_d() in assignments to bpage->in_LRU_list instead of #ifdef UNIV_DEBUG.

buf_LRU_remove_block(): Move an assertion to a more appropriate place.
parent b2274cb5
...@@ -733,24 +733,22 @@ buf_LRU_remove_block( ...@@ -733,24 +733,22 @@ buf_LRU_remove_block(
/* If the LRU_old pointer is defined and points to just this block, /* If the LRU_old pointer is defined and points to just this block,
move it backward one step */ move it backward one step */
if (bpage == buf_pool->LRU_old) { if (UNIV_UNLIKELY(bpage == buf_pool->LRU_old)) {
/* Below: the previous block is guaranteed to exist, because /* Below: the previous block is guaranteed to exist, because
the LRU_old pointer is only allowed to differ by the the LRU_old pointer is only allowed to differ by the
tolerance value from strict 3/8 of the LRU list length. */ tolerance value from strict 3/8 of the LRU list length. */
buf_pool->LRU_old = UT_LIST_GET_PREV(LRU, bpage); buf_pool->LRU_old = UT_LIST_GET_PREV(LRU, bpage);
ut_a(buf_pool->LRU_old);
buf_page_set_old(buf_pool->LRU_old, TRUE); buf_page_set_old(buf_pool->LRU_old, TRUE);
buf_pool->LRU_old_len++; buf_pool->LRU_old_len++;
ut_a(buf_pool->LRU_old);
} }
/* Remove the block from the LRU list */ /* Remove the block from the LRU list */
UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage); UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage);
#ifdef UNIV_DEBUG ut_d(bpage->in_LRU_list = FALSE);
bpage->in_LRU_list = FALSE;
#endif /* UNIV_DEBUG */
/* If the LRU list is so short that LRU_old not defined, return */ /* If the LRU list is so short that LRU_old not defined, return */
if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN) { if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN) {
...@@ -800,9 +798,7 @@ buf_LRU_add_block_to_end_low( ...@@ -800,9 +798,7 @@ buf_LRU_add_block_to_end_low(
ut_ad(!bpage->in_LRU_list); ut_ad(!bpage->in_LRU_list);
UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage); UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage);
#ifdef UNIV_DEBUG ut_d(bpage->in_LRU_list = TRUE);
bpage->in_LRU_list = TRUE;
#endif /* UNIV_DEBUG */
if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) { if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
...@@ -864,9 +860,7 @@ buf_LRU_add_block_low( ...@@ -864,9 +860,7 @@ buf_LRU_add_block_low(
bpage->LRU_position = (buf_pool->LRU_old)->LRU_position; bpage->LRU_position = (buf_pool->LRU_old)->LRU_position;
} }
#ifdef UNIV_DEBUG ut_d(bpage->in_LRU_list = TRUE);
bpage->in_LRU_list = TRUE;
#endif /* UNIV_DEBUG */
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) { if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
......
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