37 #ifndef UNIV_HOTBACKUP
44 #define BUF_GET_IF_IN_POOL 11
45 #define BUF_GET_NO_LATCH 14
51 #define BUF_GET_IF_IN_POOL_OR_WATCH 15
58 #define BUF_MAKE_YOUNG 51
63 #define BUF_KEEP_OLD 52
67 #define MAX_BUFFER_POOLS 64
70 #define BUF_POOL_WATCH_SIZE 1
73 extern buf_pool_t* buf_pool_ptr;
76 extern ibool buf_debug_prints;
86 #define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL
116 #ifndef UNIV_HOTBACKUP
155 buf_pool_drop_hash_index(
void);
170 __attribute__((nonnull));
175 buf_pool_resize(
void);
197 buf_pool_get_oldest_modification(
void);
226 #ifndef UNIV_HOTBACKUP
231 #define buf_page_get(SP, ZS, OF, LA, MTR) buf_page_get_gen(\
232 SP, ZS, OF, LA, NULL,\
233 BUF_GET, __FILE__, __LINE__, MTR)
240 #define buf_page_get_with_no_latch(SP, ZS, OF, MTR) buf_page_get_gen(\
241 SP, ZS, OF, RW_NO_LATCH, NULL,\
242 BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
249 buf_page_optimistic_get(
253 ib_uint64_t modify_clock,
264 buf_page_get_known_nowait(
279 buf_page_try_get_func(
293 #define buf_page_try_get(space_id, page_no, mtr) \
294 buf_page_try_get_func(space_id, page_no, __FILE__, __LINE__, mtr);
351 buf_page_init_for_backup_restore(
361 #ifndef UNIV_HOTBACKUP
406 buf_reset_check_index_page_at_flush(
410 #ifdef UNIV_DEBUG_FILE_ACCESSES
419 buf_page_set_file_page_was_freed(
431 buf_page_reset_file_page_was_freed(
444 __attribute__((pure));
453 __attribute__((pure));
472 buf_page_peek_if_search_hashed(
505 # define buf_block_modify_clock_inc(block) ((void) 0)
514 buf_calc_page_new_checksum(
527 buf_calc_page_old_checksum(
535 buf_page_is_corrupted(
537 const byte* read_buf,
540 #ifndef UNIV_HOTBACKUP
560 __attribute__((pure));
568 buf_pool_contains_zip(
573 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
582 #if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
597 const byte* read_buf,
609 #ifndef UNIV_HOTBACKUP
616 buf_get_latched_pages_number(
void);
624 buf_get_n_pending_ios(
void);
639 buf_get_modified_ratio_pct(
void);
645 buf_refresh_io_stats(
652 buf_refresh_io_stats_all(
void);
667 buf_pool_check_no_pending_io(
void);
675 buf_pool_invalidate(
void);
683 #ifdef UNIV_SYNC_DEBUG
690 buf_block_dbg_add_level(
696 # define buf_block_dbg_add_level(block, level)
714 __attribute__((pure));
739 __attribute__((pure));
740 #ifndef UNIV_HOTBACKUP
749 __attribute__((pure));
759 __attribute__((pure));
769 __attribute__((pure));
795 __attribute__((pure));
804 __attribute__((pure));
830 __attribute__((pure));
840 __attribute__((pure));
857 __attribute__((nonnull, pure));
866 __attribute__((nonnull));
877 __attribute__((pure));
888 __attribute__((pure));
890 # define buf_block_get_frame(block) (block)->frame
900 __attribute__((pure));
909 __attribute__((pure));
918 __attribute__((pure));
927 __attribute__((pure));
936 __attribute__((pure));
945 __attribute__((pure));
949 #define buf_block_get_page_zip(block) \
950 (UNIV_LIKELY_NULL((block)->page.zip.data) ? &(block)->page.zip : NULL)
951 #ifndef UNIV_HOTBACKUP
966 buf_pointer_is_block_field(
973 #define buf_pool_is_block_mutex(m) \
974 buf_pointer_is_block_field((const void*)(m))
978 #define buf_pool_is_block_lock(l) \
979 buf_pointer_is_block_field((const void*)(l))
981 #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
988 buf_frame_get_page_zip(
1004 buf_page_init_for_read(
1011 ib_int64_t tablespace_version,
1020 buf_page_io_complete(
1033 __attribute__((
const));
1042 __attribute__((nonnull,
const));
1126 buf_pool_watch_is_sentinel(
1130 UNIV_WARN_UNUSED_RESULT;
1141 UNIV_WARN_UNUSED_RESULT;
1147 buf_pool_watch_unset(
1158 buf_pool_watch_occurred(
1162 UNIV_WARN_UNUSED_RESULT;
1167 buf_get_total_list_len(
1171 ulint* flush_list_len);
1206 #ifndef UNIV_HOTBACKUP
1218 # if MAX_BUFFER_POOLS > 64
1219 # error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6"
1229 #ifndef UNIV_HOTBACKUP
1271 ibool in_flush_list;
1333 # ifdef UNIV_DEBUG_FILE_ACCESSES
1334 ibool file_page_was_freed;
1356 #ifndef UNIV_HOTBACKUP
1363 ibool in_unzip_LRU_list;
1434 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
1454 # ifdef UNIV_SYNC_DEBUG
1469 #define buf_block_state_valid(block) \
1470 (buf_block_get_state(block) >= BUF_BLOCK_NOT_USED \
1471 && (buf_block_get_state(block) <= BUF_BLOCK_REMOVE_HASH))
1473 #ifndef UNIV_HOTBACKUP
1477 #define BUF_POOL_ZIP_FOLD_PTR(ptr) ((ulint) (ptr) / UNIV_PAGE_SIZE)
1478 #define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame)
1479 #define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
1539 ulint buddy_n_frames;
1542 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
1543 ulint mutex_exit_forbidden;
1588 ulint
n_flush[BUF_FLUSH_N_TYPES];
1667 #if BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE
1668 # error "BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE"
1678 #define buf_pool_mutex_own(b) mutex_own(&b->mutex)
1680 #define buf_pool_mutex_enter(b) do { \
1681 ut_ad(!mutex_own(&b->zip_mutex)); \
1682 mutex_enter(&b->mutex); \
1686 #define buf_flush_list_mutex_own(b) mutex_own(&b->flush_list_mutex)
1689 #define buf_flush_list_mutex_enter(b) do { \
1690 mutex_enter(&b->flush_list_mutex); \
1693 # define buf_flush_list_mutex_exit(b) do { \
1694 mutex_exit(&b->flush_list_mutex); \
1699 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
1701 # define buf_pool_mutex_exit_forbid(b) do { \
1702 ut_ad(buf_pool_mutex_own(b)); \
1703 b->mutex_exit_forbidden++; \
1706 # define buf_pool_mutex_exit_allow(b) do { \
1707 ut_ad(buf_pool_mutex_own(b)); \
1708 ut_a(b->mutex_exit_forbidden); \
1709 b->mutex_exit_forbidden--; \
1712 # define buf_pool_mutex_exit(b) do { \
1713 ut_a(!b->mutex_exit_forbidden); \
1714 mutex_exit(&b->mutex); \
1718 # define buf_pool_mutex_exit_forbid(b) ((void) 0)
1720 # define buf_pool_mutex_exit_allow(b) ((void) 0)
1722 # define buf_pool_mutex_exit(b) mutex_exit(&b->mutex)
1772 #include "buf0buf.ic"