Commit da54bec7 authored by marko's avatar marko

branches/zip: Minor fixes.

buf_LRU_old_adjust_len(): Replace a constant ut_ad() with a preprocessor check.

buf_LRU_free_block(): Remove the check for the unlikely case
buf_pool->LRU_old == prev_b in order to simplify the function.
The check was implemented as part of r2306.
parent 6aa400be
...@@ -652,7 +652,9 @@ buf_LRU_old_adjust_len(void) ...@@ -652,7 +652,9 @@ buf_LRU_old_adjust_len(void)
ut_a(buf_pool->LRU_old); ut_a(buf_pool->LRU_old);
ut_ad(buf_pool_mutex_own()); ut_ad(buf_pool_mutex_own());
ut_ad(3 * (BUF_LRU_OLD_MIN_LEN / 8) > BUF_LRU_OLD_TOLERANCE + 5); #if 3 * (BUF_LRU_OLD_MIN_LEN / 8) <= BUF_LRU_OLD_TOLERANCE + 5
# error "3 * (BUF_LRU_OLD_MIN_LEN / 8) <= BUF_LRU_OLD_TOLERANCE + 5"
#endif
for (;;) { for (;;) {
old_len = buf_pool->LRU_old_len; old_len = buf_pool->LRU_old_len;
...@@ -1032,6 +1034,8 @@ alloc: ...@@ -1032,6 +1034,8 @@ alloc:
/* Insert b where bpage was in the LRU list. */ /* Insert b where bpage was in the LRU list. */
if (UNIV_LIKELY(prev_b != NULL)) { if (UNIV_LIKELY(prev_b != NULL)) {
ulint lru_len;
ut_ad(prev_b->in_LRU_list); ut_ad(prev_b->in_LRU_list);
ut_ad(buf_page_in_file(prev_b)); ut_ad(buf_page_in_file(prev_b));
UNIV_MEM_ASSERT_RW(prev_b, sizeof *prev_b); UNIV_MEM_ASSERT_RW(prev_b, sizeof *prev_b);
...@@ -1039,35 +1043,23 @@ alloc: ...@@ -1039,35 +1043,23 @@ alloc:
UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU,
prev_b, b); prev_b, b);
if (UNIV_UNLIKELY
(buf_pool->LRU_old == prev_b)) {
ut_a(buf_page_is_old(b));
ut_a(buf_page_is_old(prev_b));
buf_page_set_old(prev_b, FALSE);
buf_pool->LRU_old = b;
} else {
ulint lru_len = UT_LIST_GET_LEN(
buf_pool->LRU);
if (buf_page_is_old(b)) { if (buf_page_is_old(b)) {
buf_pool->LRU_old_len++; buf_pool->LRU_old_len++;
} }
lru_len = UT_LIST_GET_LEN(buf_pool->LRU);
if (lru_len > BUF_LRU_OLD_MIN_LEN) { if (lru_len > BUF_LRU_OLD_MIN_LEN) {
ut_ad(buf_pool->LRU_old); ut_ad(buf_pool->LRU_old);
/* Adjust the length /* Adjust the length of the
of the old block list old block list if necessary */
if necessary */
buf_LRU_old_adjust_len(); buf_LRU_old_adjust_len();
} else if (lru_len } else if (lru_len == BUF_LRU_OLD_MIN_LEN) {
== BUF_LRU_OLD_MIN_LEN) { /* The LRU list is now long
/* The LRU list is now enough for LRU_old to become
long enough for
LRU_old to become
defined: init it */ defined: init it */
buf_LRU_old_init(); buf_LRU_old_init();
} }
}
} else { } else {
ut_d(b->in_LRU_list = FALSE); ut_d(b->in_LRU_list = FALSE);
buf_LRU_add_block_low(b, buf_page_is_old(b)); buf_LRU_add_block_low(b, buf_page_is_old(b));
......
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