Commit bae70109 authored by marko's avatar marko

branches/zip: buf_page_t: Rename free_or_flush_list to list

and document the possible list memberships.
parent db53c1eb
...@@ -693,8 +693,7 @@ buf_chunk_init( ...@@ -693,8 +693,7 @@ buf_chunk_init(
memset(block->frame, '\0', UNIV_PAGE_SIZE); memset(block->frame, '\0', UNIV_PAGE_SIZE);
#endif #endif
/* Add the block to the free list */ /* Add the block to the free list */
UT_LIST_ADD_LAST(free_or_flush_list, buf_pool->free, UT_LIST_ADD_LAST(list, buf_pool->free, (&block->page));
(&block->page));
ut_d(block->page.in_free_list = TRUE); ut_d(block->page.in_free_list = TRUE);
block++; block++;
...@@ -794,8 +793,7 @@ buf_chunk_free( ...@@ -794,8 +793,7 @@ buf_chunk_free(
ut_ad(!block->page.in_LRU_list); ut_ad(!block->page.in_LRU_list);
/* Remove the block from the free list. */ /* Remove the block from the free list. */
ut_ad(block->page.in_free_list); ut_ad(block->page.in_free_list);
UT_LIST_REMOVE(free_or_flush_list, buf_pool->free, UT_LIST_REMOVE(list, buf_pool->free, (&block->page));
(&block->page));
/* Free the latches. */ /* Free the latches. */
mutex_free(&block->mutex); mutex_free(&block->mutex);
......
...@@ -61,7 +61,7 @@ buf_flush_insert_into_flush_list( ...@@ -61,7 +61,7 @@ buf_flush_insert_into_flush_list(
|| (UT_LIST_GET_FIRST(buf_pool->flush_list)->oldest_modification || (UT_LIST_GET_FIRST(buf_pool->flush_list)->oldest_modification
<= bpage->oldest_modification)); <= bpage->oldest_modification));
UT_LIST_ADD_FIRST(free_or_flush_list, buf_pool->flush_list, bpage); UT_LIST_ADD_FIRST(list, buf_pool->flush_list, bpage);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_flush_validate_low()); ut_a(buf_flush_validate_low());
...@@ -90,15 +90,14 @@ buf_flush_insert_sorted_into_flush_list( ...@@ -90,15 +90,14 @@ buf_flush_insert_sorted_into_flush_list(
while (b && b->oldest_modification > bpage->oldest_modification) { while (b && b->oldest_modification > bpage->oldest_modification) {
prev_b = b; prev_b = b;
b = UT_LIST_GET_NEXT(free_or_flush_list, b); b = UT_LIST_GET_NEXT(list, b);
} }
if (prev_b == NULL) { if (prev_b == NULL) {
UT_LIST_ADD_FIRST(free_or_flush_list, UT_LIST_ADD_FIRST(list, buf_pool->flush_list, bpage);
buf_pool->flush_list, bpage);
} else { } else {
UT_LIST_INSERT_AFTER(free_or_flush_list, UT_LIST_INSERT_AFTER(list, buf_pool->flush_list,
buf_pool->flush_list, prev_b, bpage); prev_b, bpage);
} }
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
...@@ -195,10 +194,9 @@ buf_flush_write_complete( ...@@ -195,10 +194,9 @@ buf_flush_write_complete(
bpage->oldest_modification = 0; bpage->oldest_modification = 0;
UT_LIST_REMOVE(free_or_flush_list, buf_pool->flush_list, bpage); UT_LIST_REMOVE(list, buf_pool->flush_list, bpage);
ut_d(UT_LIST_VALIDATE(free_or_flush_list, buf_page_t, ut_d(UT_LIST_VALIDATE(list, buf_page_t, buf_pool->flush_list));
buf_pool->flush_list));
flush_type = buf_page_get_flush_type(bpage); flush_type = buf_page_get_flush_type(bpage);
buf_pool->n_flush[flush_type]--; buf_pool->n_flush[flush_type]--;
...@@ -1000,8 +998,7 @@ buf_flush_batch( ...@@ -1000,8 +998,7 @@ buf_flush_batch(
mutex_exit(block_mutex); mutex_exit(block_mutex);
bpage = UT_LIST_GET_PREV(free_or_flush_list, bpage = UT_LIST_GET_PREV(list, bpage);
bpage);
} }
} }
...@@ -1148,7 +1145,7 @@ buf_flush_validate_low(void) ...@@ -1148,7 +1145,7 @@ buf_flush_validate_low(void)
buf_page_t* bpage; buf_page_t* bpage;
ib_uint64_t om; ib_uint64_t om;
UT_LIST_VALIDATE(free_or_flush_list, buf_page_t, buf_pool->flush_list); UT_LIST_VALIDATE(list, buf_page_t, buf_pool->flush_list);
bpage = UT_LIST_GET_FIRST(buf_pool->flush_list); bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
...@@ -1157,7 +1154,7 @@ buf_flush_validate_low(void) ...@@ -1157,7 +1154,7 @@ buf_flush_validate_low(void)
ut_a(buf_page_in_file(bpage)); ut_a(buf_page_in_file(bpage));
ut_a(om > 0); ut_a(om > 0);
bpage = UT_LIST_GET_NEXT(free_or_flush_list, bpage); bpage = UT_LIST_GET_NEXT(list, bpage);
if (bpage) { if (bpage) {
ut_a(om >= bpage->oldest_modification); ut_a(om >= bpage->oldest_modification);
......
...@@ -138,8 +138,7 @@ buf_LRU_invalidate_tablespace( ...@@ -138,8 +138,7 @@ buf_LRU_invalidate_tablespace(
blocks */ blocks */
bpage->oldest_modification = 0; bpage->oldest_modification = 0;
UT_LIST_REMOVE(free_or_flush_list, UT_LIST_REMOVE(list, buf_pool->flush_list,
buf_pool->flush_list,
bpage); bpage);
} }
...@@ -464,8 +463,7 @@ buf_LRU_get_free_block( ...@@ -464,8 +463,7 @@ buf_LRU_get_free_block(
ut_d(block->page.in_free_list = FALSE); ut_d(block->page.in_free_list = FALSE);
ut_ad(!block->page.in_LRU_list); ut_ad(!block->page.in_LRU_list);
ut_a(!buf_page_in_file(&block->page)); ut_a(!buf_page_in_file(&block->page));
UT_LIST_REMOVE(free_or_flush_list, buf_pool->free, UT_LIST_REMOVE(list, buf_pool->free, (&block->page));
(&block->page));
if (buf_block_get_zip_size(block) != zip_size) { if (buf_block_get_zip_size(block) != zip_size) {
page_zip_set_size(&block->page.zip, zip_size); page_zip_set_size(&block->page.zip, zip_size);
...@@ -917,7 +915,7 @@ buf_LRU_block_free_non_file_page( ...@@ -917,7 +915,7 @@ buf_LRU_block_free_non_file_page(
page_zip_set_size(&block->page.zip, 0); page_zip_set_size(&block->page.zip, 0);
} }
UT_LIST_ADD_FIRST(free_or_flush_list, buf_pool->free, (&block->page)); UT_LIST_ADD_FIRST(list, buf_pool->free, (&block->page));
ut_d(block->page.in_free_list = TRUE); ut_d(block->page.in_free_list = TRUE);
UNIV_MEM_INVALID(block->frame, UNIV_PAGE_SIZE); UNIV_MEM_INVALID(block->frame, UNIV_PAGE_SIZE);
...@@ -1086,11 +1084,11 @@ buf_LRU_validate(void) ...@@ -1086,11 +1084,11 @@ buf_LRU_validate(void)
ut_a(buf_pool->LRU_old_len == old_len); ut_a(buf_pool->LRU_old_len == old_len);
} }
UT_LIST_VALIDATE(free_or_flush_list, buf_page_t, buf_pool->free); UT_LIST_VALIDATE(list, buf_page_t, buf_pool->free);
for (bpage = UT_LIST_GET_FIRST(buf_pool->free); for (bpage = UT_LIST_GET_FIRST(buf_pool->free);
bpage != NULL; bpage != NULL;
bpage = UT_LIST_GET_NEXT(free_or_flush_list, bpage)) { bpage = UT_LIST_GET_NEXT(list, bpage)) {
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_NOT_USED); ut_a(buf_page_get_state(bpage) == BUF_BLOCK_NOT_USED);
} }
......
...@@ -920,12 +920,16 @@ struct buf_page_struct{ ...@@ -920,12 +920,16 @@ struct buf_page_struct{
/* 2. Page flushing fields; protected by buf_pool->mutex */ /* 2. Page flushing fields; protected by buf_pool->mutex */
UT_LIST_NODE_T(buf_page_t) free_or_flush_list; UT_LIST_NODE_T(buf_page_t) list;
/* if buf_page_in_file(), this is a /* based on state, this is a list
node of the modified, not yet node in one of the following lists
flushed blocks list; in buf_pool:
if state == BUF_BLOCK_NOT_USED,
this is a node of the "free" list */ BUF_BLOCK_NOT_USED: free
BUF_BLOCK_FILE_PAGE: flush_list
BUF_BLOCK_ZIP_DIRTY: flush_list
BUF_BLOCK_ZIP_PAGE: zip_clean
BUF_BLOCK_ZIP_FREE: zip_free[] */
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
ibool in_free_list; /* TRUE if in the free list; used in ibool in_free_list; /* TRUE if in the free list; used in
debugging */ debugging */
......
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