37 #ifndef UNIV_HOTBACKUP
44 #define BUF_GET_IF_IN_POOL 11
45 #define BUF_PEEK_IF_IN_POOL 12
47 #define BUF_GET_NO_LATCH 14
53 #define BUF_GET_IF_IN_POOL_OR_WATCH 15
60 #define BUF_MAKE_YOUNG 51
65 #define BUF_KEEP_OLD 52
69 #define MAX_BUFFER_POOLS 64
72 #define BUF_POOL_WATCH_SIZE 1
75 extern buf_pool_t* buf_pool_ptr;
78 extern ibool buf_debug_prints;
88 #define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL
188 #ifndef UNIV_HOTBACKUP
227 buf_pool_drop_hash_index(
void);
242 __attribute__((nonnull));
247 buf_pool_resize(
void);
269 buf_pool_get_oldest_modification(
void);
298 #ifndef UNIV_HOTBACKUP
303 #define buf_page_get(SP, ZS, OF, LA, MTR) buf_page_get_gen(\
304 SP, ZS, OF, LA, NULL,\
305 BUF_GET, __FILE__, __LINE__, MTR)
312 #define buf_page_get_with_no_latch(SP, ZS, OF, MTR) buf_page_get_gen(\
313 SP, ZS, OF, RW_NO_LATCH, NULL,\
314 BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
321 buf_page_optimistic_get(
325 ib_uint64_t modify_clock,
336 buf_page_get_known_nowait(
351 buf_page_try_get_func(
365 #define buf_page_try_get(space_id, page_no, mtr) \
366 buf_page_try_get_func(space_id, page_no, __FILE__, __LINE__, mtr);
423 buf_page_init_for_backup_restore(
433 #ifndef UNIV_HOTBACKUP
478 buf_reset_check_index_page_at_flush(
482 #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
491 buf_page_set_file_page_was_freed(
503 buf_page_reset_file_page_was_freed(
516 __attribute__((pure));
525 __attribute__((pure));
544 buf_page_peek_if_search_hashed(
577 # define buf_block_modify_clock_inc(block) ((void) 0)
586 buf_calc_page_new_checksum(
599 buf_calc_page_old_checksum(
607 buf_page_is_corrupted(
609 const byte* read_buf,
612 #ifndef UNIV_HOTBACKUP
632 __attribute__((pure));
640 buf_pool_contains_zip(
645 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
654 #if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
669 const byte* read_buf,
681 #ifndef UNIV_HOTBACKUP
688 buf_get_latched_pages_number(
void);
696 buf_get_n_pending_ios(
void);
711 buf_get_modified_ratio_pct(
void);
717 buf_refresh_io_stats(
724 buf_refresh_io_stats_all(
void);
739 buf_pool_check_no_pending_io(
void);
747 buf_pool_invalidate(
void);
755 #ifdef UNIV_SYNC_DEBUG
762 buf_block_dbg_add_level(
768 # define buf_block_dbg_add_level(block, level)
786 __attribute__((pure));
811 __attribute__((pure));
812 #ifndef UNIV_HOTBACKUP
821 __attribute__((pure));
831 __attribute__((pure));
841 __attribute__((pure));
867 __attribute__((pure));
876 __attribute__((pure));
902 __attribute__((pure));
912 __attribute__((pure));
929 __attribute__((nonnull, pure));
938 __attribute__((nonnull));
949 __attribute__((pure));
960 __attribute__((pure));
962 # define buf_block_get_frame(block) (block)->frame
972 __attribute__((pure));
981 __attribute__((pure));
990 __attribute__((pure));
999 __attribute__((pure));
1008 __attribute__((pure));
1017 __attribute__((pure));
1021 #define buf_block_get_page_zip(block) \
1022 (UNIV_LIKELY_NULL((block)->page.zip.data) ? &(block)->page.zip : NULL)
1023 #ifndef UNIV_HOTBACKUP
1038 buf_pointer_is_block_field(
1045 #define buf_pool_is_block_mutex(m) \
1046 buf_pointer_is_block_field((const void*)(m))
1050 #define buf_pool_is_block_lock(l) \
1051 buf_pointer_is_block_field((const void*)(l))
1053 #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
1060 buf_frame_get_page_zip(
1076 buf_page_init_for_read(
1083 ib_int64_t tablespace_version,
1092 buf_page_io_complete(
1105 __attribute__((
const));
1114 __attribute__((nonnull,
const));
1198 buf_pool_watch_is_sentinel(
1202 UNIV_WARN_UNUSED_RESULT;
1213 UNIV_WARN_UNUSED_RESULT;
1219 buf_pool_watch_unset(
1230 buf_pool_watch_occurred(
1234 UNIV_WARN_UNUSED_RESULT;
1239 buf_get_total_list_len(
1278 #ifndef UNIV_HOTBACKUP
1290 # if MAX_BUFFER_POOLS > 64
1291 # error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6"
1301 #ifndef UNIV_HOTBACKUP
1343 ibool in_flush_list;
1405 # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
1406 ibool file_page_was_freed;
1428 #ifndef UNIV_HOTBACKUP
1435 ibool in_unzip_LRU_list;
1506 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
1526 # ifdef UNIV_SYNC_DEBUG
1541 #define buf_block_state_valid(block) \
1542 (buf_block_get_state(block) >= BUF_BLOCK_NOT_USED \
1543 && (buf_block_get_state(block) <= BUF_BLOCK_REMOVE_HASH))
1545 #ifndef UNIV_HOTBACKUP
1549 #define BUF_POOL_ZIP_FOLD_PTR(ptr) ((ulint) (ptr) / UNIV_PAGE_SIZE)
1550 #define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame)
1551 #define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
1611 ulint buddy_n_frames;
1614 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
1615 ulint mutex_exit_forbidden;
1739 #if BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE
1740 # error "BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE"
1750 #define buf_pool_mutex_own(b) mutex_own(&b->mutex)
1752 #define buf_pool_mutex_enter(b) do { \
1753 ut_ad(!mutex_own(&b->zip_mutex)); \
1754 mutex_enter(&b->mutex); \
1758 #define buf_flush_list_mutex_own(b) mutex_own(&b->flush_list_mutex)
1761 #define buf_flush_list_mutex_enter(b) do { \
1762 mutex_enter(&b->flush_list_mutex); \
1765 # define buf_flush_list_mutex_exit(b) do { \
1766 mutex_exit(&b->flush_list_mutex); \
1771 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
1773 # define buf_pool_mutex_exit_forbid(b) do { \
1774 ut_ad(buf_pool_mutex_own(b)); \
1775 b->mutex_exit_forbidden++; \
1778 # define buf_pool_mutex_exit_allow(b) do { \
1779 ut_ad(buf_pool_mutex_own(b)); \
1780 ut_a(b->mutex_exit_forbidden); \
1781 b->mutex_exit_forbidden--; \
1784 # define buf_pool_mutex_exit(b) do { \
1785 ut_a(!b->mutex_exit_forbidden); \
1786 mutex_exit(&b->mutex); \
1790 # define buf_pool_mutex_exit_forbid(b) ((void) 0)
1792 # define buf_pool_mutex_exit_allow(b) ((void) 0)
1794 # define buf_pool_mutex_exit(b) mutex_exit(&b->mutex)
1844 #include "buf0buf.ic"