From 7070b7af754de2a6b80803b152af1399211d82aa Mon Sep 17 00:00:00 2001 From: marko <> Date: Thu, 23 Nov 2006 15:14:45 +0000 Subject: [PATCH] branches/zip: Remove buf_block_t:magic_n. buf_block_state_valid(): New macro for replacing the magic_n check --- btr/btr0sea.c | 2 +- buf/buf0buf.c | 6 ------ include/buf0buf.h | 6 ++++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/btr/btr0sea.c b/btr/btr0sea.c index 6bffa32d255..fefe36f14bd 100644 --- a/btr/btr0sea.c +++ b/btr/btr0sea.c @@ -356,7 +356,7 @@ btr_search_update_block_hash_info( info->last_hash_succ = FALSE; - ut_a(block->magic_n == BUF_BLOCK_MAGIC_N); + ut_a(buf_block_state_valid(block)); ut_ad(info->magic_n == BTR_SEARCH_MAGIC_N); if ((block->n_hash_helps > 0) diff --git a/buf/buf0buf.c b/buf/buf0buf.c index a9bb7470056..1ab362d7bf1 100644 --- a/buf/buf0buf.c +++ b/buf/buf0buf.c @@ -603,8 +603,6 @@ buf_block_init( buf_block_t* block, /* in: pointer to control block */ byte* frame) /* in: pointer to buffer frame */ { - block->magic_n = 0; - block->state = BUF_BLOCK_NOT_USED; block->frame = frame; @@ -1783,8 +1781,6 @@ buf_page_init_for_backup_restore( buf_block_t* block) /* in: block to init */ { /* Set the state of the block */ - block->magic_n = BUF_BLOCK_MAGIC_N; - buf_block_set_file_page(block, space, offset); block->lock_hash_val = 0; @@ -1833,8 +1829,6 @@ buf_page_init( ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE); /* Set the state of the block */ - block->magic_n = BUF_BLOCK_MAGIC_N; - buf_block_set_file_page(block, space, offset); block->check_index_page_at_flush = FALSE; diff --git a/include/buf0buf.h b/include/buf0buf.h index 3f230afbbdb..5df038bbe9d 100644 --- a/include/buf0buf.h +++ b/include/buf0buf.h @@ -708,7 +708,6 @@ struct buf_block_struct{ /* 1. General fields */ - ulint magic_n; /* magic number to check */ ulint state; /* state of the control block: BUF_BLOCK_NOT_USED, ...; changing this is only allowed when a thread @@ -870,7 +869,10 @@ struct buf_block_struct{ #endif /* UNIV_DEBUG_FILE_ACCESSES */ }; -#define BUF_BLOCK_MAGIC_N 41526563 +/* Check if a block is in a valid state. */ +#define buf_block_state_valid(block) \ +(buf_block_get_state(block) >= BUF_BLOCK_NOT_USED \ + && (buf_block_get_state(block) <= BUF_BLOCK_REMOVE_HASH)) /* The buffer pool structure. NOTE! The definition appears here only for other modules of this directory (buf) to see it. Do not use from outside! */