Commit ee2b2dc7 authored by marko's avatar marko

branches/zip: UT_LIST_VALIDATE(): Add the parameter ASSERTION and

adjust all callers.
parent 48070b53
...@@ -136,7 +136,9 @@ buf_buddy_alloc_zip( ...@@ -136,7 +136,9 @@ buf_buddy_alloc_zip(
#if defined UNIV_DEBUG && !defined UNIV_DEBUG_VALGRIND #if defined UNIV_DEBUG && !defined UNIV_DEBUG_VALGRIND
/* Valgrind would complain about accessing free memory. */ /* Valgrind would complain about accessing free memory. */
UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[i]); UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[i],
ut_a(buf_page_get_state(ut_list_node_313)
== BUF_BLOCK_ZIP_FREE));
#endif /* UNIV_DEBUG && !UNIV_DEBUG_VALGRIND */ #endif /* UNIV_DEBUG && !UNIV_DEBUG_VALGRIND */
bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]); bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]);
...@@ -264,7 +266,9 @@ buf_buddy_alloc_from( ...@@ -264,7 +266,9 @@ buf_buddy_alloc_from(
bpage->state = BUF_BLOCK_ZIP_FREE; bpage->state = BUF_BLOCK_ZIP_FREE;
#if defined UNIV_DEBUG && !defined UNIV_DEBUG_VALGRIND #if defined UNIV_DEBUG && !defined UNIV_DEBUG_VALGRIND
/* Valgrind would complain about accessing free memory. */ /* Valgrind would complain about accessing free memory. */
UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[j]); UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[j],
ut_a(buf_page_get_state(ut_list_node_313)
== BUF_BLOCK_ZIP_FREE));
#endif /* UNIV_DEBUG && !UNIV_DEBUG_VALGRIND */ #endif /* UNIV_DEBUG && !UNIV_DEBUG_VALGRIND */
buf_buddy_add_to_free(bpage, j); buf_buddy_add_to_free(bpage, j);
} }
...@@ -573,7 +577,9 @@ buddy_free2: ...@@ -573,7 +577,9 @@ buddy_free2:
#ifndef UNIV_DEBUG_VALGRIND #ifndef UNIV_DEBUG_VALGRIND
buddy_nonfree: buddy_nonfree:
/* Valgrind would complain about accessing free memory. */ /* Valgrind would complain about accessing free memory. */
ut_d(UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[i])); ut_d(UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[i],
ut_a(buf_page_get_state(ut_list_node_313)
== BUF_BLOCK_ZIP_FREE)));
#endif /* UNIV_DEBUG_VALGRIND */ #endif /* UNIV_DEBUG_VALGRIND */
/* 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? */
......
...@@ -1155,7 +1155,8 @@ buf_relocate( ...@@ -1155,7 +1155,8 @@ buf_relocate(
#endif /* UNIV_LRU_DEBUG */ #endif /* UNIV_LRU_DEBUG */
} }
ut_d(UT_LIST_VALIDATE(LRU, buf_page_t, buf_pool->LRU)); ut_d(UT_LIST_VALIDATE(LRU, buf_page_t, buf_pool->LRU,
ut_ad(ut_list_node_313->in_LRU_list)));
/* relocate buf_pool->page_hash */ /* relocate buf_pool->page_hash */
fold = buf_page_address_fold(bpage->space, bpage->offset); fold = buf_page_address_fold(bpage->space, bpage->offset);
......
...@@ -227,7 +227,8 @@ buf_flush_remove( ...@@ -227,7 +227,8 @@ buf_flush_remove(
bpage->oldest_modification = 0; bpage->oldest_modification = 0;
ut_d(UT_LIST_VALIDATE(list, buf_page_t, buf_pool->flush_list)); ut_d(UT_LIST_VALIDATE(list, buf_page_t, buf_pool->flush_list,
ut_ad(ut_list_node_313->in_flush_list)));
} }
/************************************************************************ /************************************************************************
...@@ -1206,7 +1207,8 @@ buf_flush_validate_low(void) ...@@ -1206,7 +1207,8 @@ buf_flush_validate_low(void)
{ {
buf_page_t* bpage; buf_page_t* bpage;
UT_LIST_VALIDATE(list, buf_page_t, buf_pool->flush_list); UT_LIST_VALIDATE(list, buf_page_t, buf_pool->flush_list,
ut_ad(ut_list_node_313->in_flush_list));
bpage = UT_LIST_GET_FIRST(buf_pool->flush_list); bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
......
...@@ -1908,7 +1908,8 @@ buf_LRU_validate(void) ...@@ -1908,7 +1908,8 @@ buf_LRU_validate(void)
ut_a(old_len <= new_len + BUF_LRU_OLD_TOLERANCE); ut_a(old_len <= new_len + BUF_LRU_OLD_TOLERANCE);
} }
UT_LIST_VALIDATE(LRU, buf_page_t, buf_pool->LRU); UT_LIST_VALIDATE(LRU, buf_page_t, buf_pool->LRU,
ut_ad(ut_list_node_313->in_LRU_list));
bpage = UT_LIST_GET_FIRST(buf_pool->LRU); bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
...@@ -1956,7 +1957,8 @@ buf_LRU_validate(void) ...@@ -1956,7 +1957,8 @@ 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(list, buf_page_t, buf_pool->free); UT_LIST_VALIDATE(list, buf_page_t, buf_pool->free,
ut_ad(ut_list_node_313->in_free_list));
for (bpage = UT_LIST_GET_FIRST(buf_pool->free); for (bpage = UT_LIST_GET_FIRST(buf_pool->free);
bpage != NULL; bpage != NULL;
...@@ -1965,7 +1967,9 @@ buf_LRU_validate(void) ...@@ -1965,7 +1967,9 @@ buf_LRU_validate(void)
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_NOT_USED); ut_a(buf_page_get_state(bpage) == BUF_BLOCK_NOT_USED);
} }
UT_LIST_VALIDATE(unzip_LRU, buf_block_t, buf_pool->unzip_LRU); UT_LIST_VALIDATE(unzip_LRU, buf_block_t, buf_pool->unzip_LRU,
ut_ad(ut_list_node_313->in_unzip_LRU_list
&& ut_list_node_313->page.in_LRU_list));
for (block = UT_LIST_GET_FIRST(buf_pool->unzip_LRU); for (block = UT_LIST_GET_FIRST(buf_pool->unzip_LRU);
block; block;
......
...@@ -4693,7 +4693,9 @@ fil_validate(void) ...@@ -4693,7 +4693,9 @@ fil_validate(void)
space = HASH_GET_FIRST(system->spaces, i); space = HASH_GET_FIRST(system->spaces, i);
while (space != NULL) { while (space != NULL) {
UT_LIST_VALIDATE(chain, fil_node_t, space->chain); UT_LIST_VALIDATE(chain, fil_node_t, space->chain,
ut_a(ut_list_node_313->open
|| !ut_list_node_313->n_pending));
fil_node = UT_LIST_GET_FIRST(space->chain); fil_node = UT_LIST_GET_FIRST(space->chain);
...@@ -4713,7 +4715,7 @@ fil_validate(void) ...@@ -4713,7 +4715,7 @@ fil_validate(void)
ut_a(system->n_open == n_open); ut_a(system->n_open == n_open);
UT_LIST_VALIDATE(LRU, fil_node_t, system->LRU); UT_LIST_VALIDATE(LRU, fil_node_t, system->LRU, (void) 0);
fil_node = UT_LIST_GET_FIRST(system->LRU); fil_node = UT_LIST_GET_FIRST(system->LRU);
......
...@@ -210,34 +210,36 @@ if the list is empty. BASE is the base node (not a pointer to it). */ ...@@ -210,34 +210,36 @@ if the list is empty. BASE is the base node (not a pointer to it). */
/************************************************************************ /************************************************************************
Checks the consistency of a two-way list. NAME is the name of the list, Checks the consistency of a two-way list. NAME is the name of the list,
TYPE is the node type, and BASE is the base node (not a pointer to it). */ TYPE is the node type, BASE is the base node (not a pointer to it),
and ASSERTION is a condition on ut_list_node_313. */
#define UT_LIST_VALIDATE(NAME, TYPE, BASE)\
{\
ulint ut_list_i_313;\
TYPE * ut_list_node_313;\
\
ut_list_node_313 = (BASE).start;\
\
for (ut_list_i_313 = 0; ut_list_i_313 < (BASE).count;\
ut_list_i_313++) {\
ut_a(ut_list_node_313);\
ut_list_node_313 = (ut_list_node_313->NAME).next;\
}\
\
ut_a(ut_list_node_313 == NULL);\
\
ut_list_node_313 = (BASE).end;\
\
for (ut_list_i_313 = 0; ut_list_i_313 < (BASE).count;\
ut_list_i_313++) {\
ut_a(ut_list_node_313);\
ut_list_node_313 = (ut_list_node_313->NAME).prev;\
}\
\
ut_a(ut_list_node_313 == NULL);\
}\
#define UT_LIST_VALIDATE(NAME, TYPE, BASE, ASSERTION) \
do { \
ulint ut_list_i_313; \
TYPE * ut_list_node_313; \
\
ut_list_node_313 = (BASE).start; \
\
for (ut_list_i_313 = 0; ut_list_i_313 < (BASE).count; \
ut_list_i_313++) { \
ut_a(ut_list_node_313); \
ASSERTION; \
ut_list_node_313 = (ut_list_node_313->NAME).next; \
} \
\
ut_a(ut_list_node_313 == NULL); \
\
ut_list_node_313 = (BASE).end; \
\
for (ut_list_i_313 = 0; ut_list_i_313 < (BASE).count; \
ut_list_i_313++) { \
ut_a(ut_list_node_313); \
ASSERTION; \
ut_list_node_313 = (ut_list_node_313->NAME).prev; \
} \
\
ut_a(ut_list_node_313 == NULL); \
} while (0)
#endif #endif
...@@ -624,7 +624,8 @@ mem_pool_validate( ...@@ -624,7 +624,8 @@ mem_pool_validate(
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
UT_LIST_VALIDATE(free_list, mem_area_t, pool->free_list[i]); UT_LIST_VALIDATE(free_list, mem_area_t, pool->free_list[i],
(void) 0);
area = UT_LIST_GET_FIRST(pool->free_list[i]); area = UT_LIST_GET_FIRST(pool->free_list[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