#!!! notice !!!
# Any small change to this file in the main branch
# should be done or reviewed by the maintainer!
-diff -ruN a/storage/innobase/buf/buf0buddy.c b/storage/innobase/buf/buf0buddy.c
---- a/storage/innobase/buf/buf0buddy.c 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/buf/buf0buddy.c 2010-12-03 15:20:49.593024343 +0900
-@@ -137,7 +137,7 @@
- ut_ad(buf_page_get_state(ut_list_node_313)
- == BUF_BLOCK_ZIP_FREE)));
- #endif /* !UNIV_DEBUG_VALGRIND */
+--- a/storage/innobase/buf/buf0buddy.c
++++ b/storage/innobase/buf/buf0buddy.c
+@@ -123,7 +123,7 @@
+
+ ut_d(BUF_BUDDY_LIST_VALIDATE(buf_pool, i));
+
- bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]);
+ bpage = UT_LIST_GET_LAST(buf_pool->zip_free[i]);
if (bpage) {
- UNIV_MEM_VALID(bpage, BUF_BUDDY_LOW << i);
-diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
---- a/storage/innobase/buf/buf0buf.c 2010-12-03 15:18:48.866986963 +0900
-+++ b/storage/innobase/buf/buf0buf.c 2010-12-03 15:20:49.595987311 +0900
-@@ -881,9 +881,9 @@
+ ut_a(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE);
+--- a/storage/innobase/buf/buf0buf.c
++++ b/storage/innobase/buf/buf0buf.c
+@@ -880,9 +880,9 @@
block->page.in_zip_hash = FALSE;
block->page.in_flush_list = FALSE;
block->page.in_free_list = FALSE;
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
block->n_pointers = 0;
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-@@ -1494,7 +1494,7 @@
+@@ -1366,7 +1366,7 @@
memcpy(dpage, bpage, sizeof *dpage);
ut_d(bpage->in_page_hash = FALSE);
/* relocate buf_pool->LRU */
-@@ -3729,8 +3729,8 @@
+@@ -3188,8 +3188,8 @@
bpage->in_zip_hash = FALSE;
bpage->in_flush_list = FALSE;
bpage->in_free_list = FALSE;
ut_d(bpage->in_page_hash = TRUE);
-@@ -3893,7 +3893,7 @@
+@@ -3354,7 +3354,7 @@
ibuf_merge_or_delete_for_page(NULL, space, offset, zip_size, TRUE);
/* Flush pages from the end of the LRU list if necessary */
frame = block->frame;
-diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
---- a/storage/innobase/buf/buf0flu.c 2010-12-03 15:18:48.868953442 +0900
-+++ b/storage/innobase/buf/buf0flu.c 2010-12-03 15:20:49.599986956 +0900
-@@ -403,19 +403,21 @@
+--- a/storage/innobase/buf/buf0flu.c
++++ b/storage/innobase/buf/buf0flu.c
+@@ -431,19 +431,21 @@
buf_page_in_file(bpage) and in the LRU list */
{
#ifdef UNIV_DEBUG
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: buffer block state %lu"
-@@ -423,6 +425,7 @@
+@@ -451,6 +453,7 @@
(ulong) buf_page_get_state(bpage));
ut_print_buf(stderr, bpage, sizeof(buf_page_t));
putc('\n', stderr);
return(FALSE);
}
-@@ -1955,8 +1958,14 @@
+@@ -1985,8 +1988,14 @@
buf_page_t* bpage;
ulint n_replaceable;
ulint distance = 0;
n_replaceable = UT_LIST_GET_LEN(buf_pool->free);
-@@ -1967,7 +1976,13 @@
+@@ -1997,7 +2006,13 @@
+ BUF_FLUSH_EXTRA_MARGIN(buf_pool))
&& (distance < BUF_LRU_FREE_SEARCH_LEN(buf_pool))) {
mutex_enter(block_mutex);
-@@ -1982,11 +1997,18 @@
+@@ -2012,11 +2027,18 @@
bpage = UT_LIST_GET_PREV(LRU, bpage);
}
}
return(BUF_FLUSH_FREE_BLOCK_MARGIN(buf_pool)
-@@ -2004,7 +2026,8 @@
+@@ -2034,7 +2056,8 @@
void
buf_flush_free_margin(
/*==================*/
{
ulint n_to_flush;
-@@ -2015,7 +2038,7 @@
+@@ -2045,7 +2068,7 @@
n_flushed = buf_flush_LRU(buf_pool, n_to_flush);
/* There was an LRU type flush batch already running;
let us wait for it to end */
-@@ -2028,8 +2051,9 @@
+@@ -2058,8 +2081,9 @@
Flushes pages from the end of all the LRU lists. */
UNIV_INTERN
void
{
ulint i;
-@@ -2038,7 +2062,7 @@
+@@ -2068,7 +2092,7 @@
buf_pool = buf_pool_from_array(i);
}
}
-diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
---- a/storage/innobase/buf/buf0lru.c 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/buf/buf0lru.c 2010-12-03 15:20:49.602952786 +0900
-@@ -1016,7 +1016,7 @@
+--- a/storage/innobase/buf/buf0lru.c
++++ b/storage/innobase/buf/buf0lru.c
+@@ -923,7 +923,7 @@
/* No free block was found: try to flush the LRU list */
++srv_buf_pool_wait_free;
os_aio_simulated_wake_handler_threads();
-@@ -1213,7 +1213,7 @@
+@@ -1120,7 +1120,7 @@
/* Remove the block from the LRU list */
UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage);
buf_unzip_LRU_remove_block_if_needed(bpage);
-@@ -1292,7 +1292,7 @@
+@@ -1199,7 +1199,7 @@
ut_ad(!bpage->in_LRU_list);
UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage);
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
-@@ -1362,7 +1362,7 @@
+@@ -1269,7 +1269,7 @@
buf_pool->LRU_old_len++;
}
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
-@@ -1617,7 +1617,7 @@
+@@ -1513,7 +1513,7 @@
buf_page_set_old(b, buf_page_is_old(b));
#endif /* UNIV_LRU_DEBUG */
} else {
buf_LRU_add_block_low(b, buf_page_is_old(b));
}
-diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
---- a/storage/innobase/buf/buf0rea.c 2010-12-03 15:18:48.870953384 +0900
-+++ b/storage/innobase/buf/buf0rea.c 2010-12-03 15:20:49.604956032 +0900
-@@ -200,7 +200,7 @@
+--- a/storage/innobase/buf/buf0rea.c
++++ b/storage/innobase/buf/buf0rea.c
+@@ -367,7 +367,7 @@
}
/* Flush pages from the end of the LRU list if necessary */
/* Increment number of I/O operations used for LRU policy. */
buf_LRU_stat_inc_io();
-@@ -476,7 +476,7 @@
+@@ -641,7 +641,7 @@
os_aio_simulated_wake_handler_threads();
/* Flush pages from the end of the LRU list if necessary */
#ifdef UNIV_DEBUG
if (buf_debug_prints && (count > 0)) {
-@@ -565,7 +565,7 @@
+@@ -729,7 +729,7 @@
os_aio_simulated_wake_handler_threads();
/* Flush pages from the end of all the LRU lists if necessary */
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
-@@ -659,7 +659,7 @@
+@@ -823,7 +823,7 @@
os_aio_simulated_wake_handler_threads();
/* Flush pages from the end of all the LRU lists if necessary */
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
-diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
---- a/storage/innobase/include/buf0buf.h 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/buf0buf.h 2010-12-03 15:20:49.608986590 +0900
-@@ -1314,11 +1314,11 @@
+--- a/storage/innobase/include/buf0buf.h
++++ b/storage/innobase/include/buf0buf.h
+@@ -1404,11 +1404,11 @@
UT_LIST_NODE_T(buf_page_t) LRU;
/*!< node of the LRU list */
unsigned old:1; /*!< TRUE if the block is in the old
blocks in buf_pool->LRU_old */
unsigned freed_page_clock:31;/*!< the value of
-diff -ruN a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h
---- a/storage/innobase/include/buf0flu.h 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/buf0flu.h 2010-12-03 15:20:49.609953185 +0900
+--- a/storage/innobase/include/buf0flu.h
++++ b/storage/innobase/include/buf0flu.h
@@ -65,13 +65,15 @@
void
buf_flush_free_margin(