36 #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 
   57 #define BUF_GET_POSSIBLY_FREED          16 
   63 #define BUF_MAKE_YOUNG  51               
   68 #define BUF_KEEP_OLD    52               
   72 #define MAX_BUFFER_POOLS_BITS   6        
   75 #define MAX_BUFFER_POOLS        (1 << MAX_BUFFER_POOLS_BITS) 
   79 #define BUF_POOL_WATCH_SIZE             (srv_n_purge_threads + 1) 
   82 #define MAX_PAGE_HASH_LOCKS     1024     
   85 extern  buf_pool_t*     buf_pool_ptr;    
   88 extern ibool            buf_debug_prints;
 
   92 extern ulint srv_buf_pool_instances;
 
   93 extern ulint srv_buf_pool_curr_size;
 
  100 #define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL 
  209 #ifndef UNIV_HOTBACKUP 
  261         __attribute__((nonnull));
 
  292         __attribute__((malloc));
 
  300         __attribute__((nonnull));
 
  329 #ifndef UNIV_HOTBACKUP 
  334 #define buf_page_get(SP, ZS, OF, LA, MTR)        buf_page_get_gen(\ 
  335                                 SP, ZS, OF, LA, NULL,\ 
  336                                 BUF_GET, __FILE__, __LINE__, MTR) 
  343 #define buf_page_get_with_no_latch(SP, ZS, OF, MTR)        buf_page_get_gen(\ 
  344                                 SP, ZS, OF, RW_NO_LATCH, NULL,\ 
  345                                 BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR) 
  356         ib_uint64_t     modify_clock,
 
  395 #define buf_page_try_get(space_id, page_no, mtr)        \ 
  396         buf_page_try_get_func(space_id, page_no, __FILE__, __LINE__, mtr); 
  453 buf_page_init_for_backup_restore(
 
  463 #ifndef UNIV_HOTBACKUP 
  503 #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG 
  512 buf_page_set_file_page_was_freed(
 
  524 buf_page_reset_file_page_was_freed(
 
  537         __attribute__((pure));
 
  546         __attribute__((pure));
 
  604 # ifdef UNIV_SYNC_DEBUG
 
  609         __attribute__((nonnull));
 
  610 # ifdef UNIV_SYNC_DEBUG 
  615 # define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(f,l,b) 
  621 # define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(b) 
  624 # define buf_block_modify_clock_inc(block) ((void) 0) 
  635         const byte*     read_buf,       
 
  638         __attribute__((nonnull, warn_unused_result));
 
  639 #ifndef UNIV_HOTBACKUP 
  659         __attribute__((pure));
 
  667 buf_pool_contains_zip(
 
  683 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG 
  692 #if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG 
  714         const byte*     read_buf,       
 
  720         UNIV_COLD __attribute__((nonnull));
 
  730 #ifndef UNIV_HOTBACKUP 
  737 buf_get_latched_pages_number(
void);
 
  816 #ifdef UNIV_SYNC_DEBUG 
  823 buf_block_dbg_add_level(
 
  829 # define buf_block_dbg_add_level(block, level)  
  847         __attribute__((pure));
 
  872         __attribute__((pure));
 
  873 #ifndef UNIV_HOTBACKUP 
  882         __attribute__((pure));
 
  892         __attribute__((pure));
 
  902         __attribute__((pure));
 
  928         __attribute__((pure));
 
  937         __attribute__((pure));
 
  983         __attribute__((pure));
 
  993         __attribute__((pure));
 
 1010         __attribute__((nonnull, pure));
 
 1018         __attribute__((nonnull));
 
 1029         __attribute__((pure));
 
 1037 buf_block_get_frame(
 
 1040         __attribute__((pure));
 
 1042 # define buf_block_get_frame(block) (block)->frame 
 1052         __attribute__((pure));
 
 1061         __attribute__((pure));
 
 1070         __attribute__((pure));
 
 1079         __attribute__((pure));
 
 1088         __attribute__((pure));
 
 1097         __attribute__((pure));
 
 1101 #define buf_block_get_page_zip(block) \ 
 1102         ((block)->page.zip.data ? &(block)->page.zip : NULL) 
 1103 #ifndef UNIV_HOTBACKUP 
 1125 #define buf_pool_is_block_mutex(m)                      \ 
 1126         buf_pointer_is_block_field((const void*)(m)) 
 1130 #define buf_pool_is_block_lock(l)                       \ 
 1131         buf_pointer_is_block_field((const void*)(l)) 
 1133 #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG 
 1140 buf_frame_get_page_zip(
 
 1163         ib_int64_t      tablespace_version,
 
 1186         __attribute__((
const));
 
 1195         __attribute__((nonnull, 
const));
 
 1300 #define buf_page_hash_get_s_locked(b, s, o, l)                  \ 
 1301         buf_page_hash_get_locked(b, s, o, l, RW_LOCK_SHARED) 
 1302 #define buf_page_hash_get_x_locked(b, s, o, l)                  \ 
 1303         buf_page_hash_get_locked(b, s, o, l, RW_LOCK_EX) 
 1304 #define buf_page_hash_get(b, s, o)                              \ 
 1305         buf_page_hash_get_locked(b, s, o, NULL, 0) 
 1307 #define buf_block_hash_get_s_locked(b, s, o, l)                 \ 
 1308         buf_block_hash_get_locked(b, s, o, l, RW_LOCK_SHARED) 
 1309 #define buf_block_hash_get_x_locked(b, s, o, l)                 \ 
 1310         buf_block_hash_get_locked(b, s, o, l, RW_LOCK_EX) 
 1311 #define buf_block_hash_get(b, s, o)                             \ 
 1312         buf_block_hash_get_locked(b, s, o, NULL, 0) 
 1331         __attribute__((nonnull, warn_unused_result));
 
 1342         __attribute__((warn_unused_result));
 
 1363         __attribute__((warn_unused_result));
 
 1372         ulint*          flush_list_len);
 
 1415 #define BUF_PAGE_STATE_BITS     3 
 1448 #ifndef UNIV_HOTBACKUP 
 1449         unsigned        flush_type:2;   
 
 1460 # if MAX_BUFFER_POOLS > 64 
 1461 #  error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6" 
 1471 #ifndef UNIV_HOTBACKUP 
 1512         ibool           in_flush_list;  
 
 1575 # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG 
 1576         ibool           file_page_was_freed;
 
 1600 #ifndef UNIV_HOTBACKUP 
 1607         ibool           in_unzip_LRU_list;
 
 1681 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG 
 1701 # ifdef UNIV_SYNC_DEBUG 
 1716 #define buf_block_state_valid(block)                            \ 
 1717 (buf_block_get_state(block) >= BUF_BLOCK_NOT_USED               \ 
 1718  && (buf_block_get_state(block) <= BUF_BLOCK_REMOVE_HASH)) 
 1720 #ifndef UNIV_HOTBACKUP 
 1724 #define BUF_POOL_ZIP_FOLD_PTR(ptr) ((ulint) (ptr) / UNIV_PAGE_SIZE) 
 1725 #define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame) 
 1726 #define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b)) 
 1759         ulint   n_pages_created;
 
 1761         ulint   n_ra_pages_read_rnd;
 
 1763         ulint   n_ra_pages_read;
 
 1765         ulint   n_ra_pages_evicted;
 
 1768         ulint   n_pages_made_young; 
 
 1770         ulint   n_pages_not_made_young; 
 
 1807         ulint           LRU_old_ratio;  
 
 1810         ulint           buddy_n_frames; 
 
 1813 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG 
 1814         ulint           mutex_exit_forbidden; 
 
 1838         time_t          last_printout_time;
 
 1871         ulint           n_flush[BUF_FLUSH_N_TYPES];
 
 1892         ulint           freed_page_clock;
 
 1946 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG 
 1958 #if BUF_BUDDY_LOW > UNIV_ZIP_SIZE_MIN 
 1959 # error "BUF_BUDDY_LOW > UNIV_ZIP_SIZE_MIN" 
 1969 #define buf_pool_mutex_own(b) mutex_own(&b->mutex) 
 1971 #define buf_pool_mutex_enter(b) do {            \ 
 1972         ut_ad(!mutex_own(&b->zip_mutex));       \ 
 1973         mutex_enter(&b->mutex);         \ 
 1977 #define buf_flush_list_mutex_own(b) mutex_own(&b->flush_list_mutex) 
 1980 #define buf_flush_list_mutex_enter(b) do {      \ 
 1981         mutex_enter(&b->flush_list_mutex);      \ 
 1984 # define buf_flush_list_mutex_exit(b) do {      \ 
 1985         mutex_exit(&b->flush_list_mutex);       \ 
 1991 # define buf_page_hash_lock_get(b, f)           \ 
 1992         hash_get_lock(b->page_hash, f) 
 1994 #ifdef UNIV_SYNC_DEBUG 
 1996 # define buf_page_hash_lock_held_s(b, p)                \ 
 1997         rw_lock_own(buf_page_hash_lock_get(b,           \ 
 1998                   buf_page_address_fold(p->space,       \ 
 2003 # define buf_page_hash_lock_held_x(b, p)                \ 
 2004         rw_lock_own(buf_page_hash_lock_get(b,           \ 
 2005                   buf_page_address_fold(p->space,       \ 
 2010 # define buf_page_hash_lock_held_s_or_x(b, p)           \ 
 2011         (buf_page_hash_lock_held_s(b, p)                \ 
 2012          || buf_page_hash_lock_held_x(b, p)) 
 2014 # define buf_block_hash_lock_held_s(b, p)               \ 
 2015         buf_page_hash_lock_held_s(b, &(p->page)) 
 2017 # define buf_block_hash_lock_held_x(b, p)               \ 
 2018         buf_page_hash_lock_held_x(b, &(p->page)) 
 2020 # define buf_block_hash_lock_held_s_or_x(b, p)          \ 
 2021         buf_page_hash_lock_held_s_or_x(b, &(p->page)) 
 2023 # define buf_page_hash_lock_held_s(b, p)        (TRUE) 
 2024 # define buf_page_hash_lock_held_x(b, p)        (TRUE) 
 2025 # define buf_page_hash_lock_held_s_or_x(b, p)   (TRUE) 
 2026 # define buf_block_hash_lock_held_s(b, p)       (TRUE) 
 2027 # define buf_block_hash_lock_held_x(b, p)       (TRUE) 
 2028 # define buf_block_hash_lock_held_s_or_x(b, p)  (TRUE) 
 2031 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG 
 2033 # define buf_pool_mutex_exit_forbid(b) do {     \ 
 2034         ut_ad(buf_pool_mutex_own(b));           \ 
 2035         b->mutex_exit_forbidden++;              \ 
 2038 # define buf_pool_mutex_exit_allow(b) do {      \ 
 2039         ut_ad(buf_pool_mutex_own(b));           \ 
 2040         ut_a(b->mutex_exit_forbidden);  \ 
 2041         b->mutex_exit_forbidden--;              \ 
 2044 # define buf_pool_mutex_exit(b) do {            \ 
 2045         ut_a(!b->mutex_exit_forbidden);         \ 
 2046         mutex_exit(&b->mutex);                  \ 
 2050 # define buf_pool_mutex_exit_forbid(b) ((void) 0) 
 2052 # define buf_pool_mutex_exit_allow(b) ((void) 0) 
 2054 # define buf_pool_mutex_exit(b) mutex_exit(&b->mutex) 
 2103 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG 
 2105 struct  CheckInLRUList {
 
 2106         void    operator()(
const buf_page_t* elem)
 const 
 2108                 ut_a(elem->in_LRU_list);
 
 2113 struct  CheckInFreeList {
 
 2114         void    operator()(
const buf_page_t* elem)
 const 
 2116                 ut_a(elem->in_free_list);
 
 2120 struct  CheckUnzipLRUAndLRUList {
 
 2124                 ut_a(elem->in_unzip_LRU_list);
 
 2130 #include "buf0buf.ic"