36
36
/**********************************************************************//**
37
37
Allocate a block. The thread calling this function must hold
38
buf_pool_mutex and must not hold buf_pool_zip_mutex or any block->mutex.
39
The buf_pool_mutex may only be released and reacquired if lru != NULL.
38
buf_pool->mutex and must not hold buf_pool_zip_mutex or any block->mutex.
39
The buf_pool->mutex may only be released and reacquired if lru != NULL.
40
40
@return allocated block, possibly NULL if lru==NULL */
43
43
buf_buddy_alloc_low(
44
44
/*================*/
46
/*!< in: buffer pool in which the page resides */
45
47
ulint i, /*!< in: index of buf_pool->zip_free[],
46
48
or BUF_BUDDY_SIZES */
47
49
ibool* lru) /*!< in: pointer to a variable that will be assigned
48
50
TRUE if storage was allocated from the LRU list
49
and buf_pool_mutex was temporarily released,
51
and buf_pool->mutex was temporarily released,
50
52
or NULL if the LRU list should not be used */
51
53
__attribute__((malloc));
57
59
buf_buddy_free_low(
58
60
/*===============*/
59
void* buf, /*!< in: block to be freed, must not be
60
pointed to by the buffer pool */
61
ulint i) /*!< in: index of buf_pool->zip_free[],
61
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
62
void* buf, /*!< in: block to be freed, must not be
63
pointed to by the buffer pool */
64
ulint i) /*!< in: index of buf_pool->zip_free[],
63
66
__attribute__((nonnull));
65
68
/**********************************************************************//**
84
87
/**********************************************************************//**
85
88
Allocate a block. The thread calling this function must hold
86
buf_pool_mutex and must not hold buf_pool_zip_mutex or any
87
block->mutex. The buf_pool_mutex may only be released and reacquired
89
buf_pool->mutex and must not hold buf_pool_zip_mutex or any
90
block->mutex. The buf_pool->mutex may only be released and reacquired
88
91
if lru != NULL. This function should only be used for allocating
89
92
compressed page frames or control blocks (buf_page_t). Allocated
90
93
control blocks must be properly initialized immediately after
91
94
buf_buddy_alloc() has returned the memory, before releasing
93
96
@return allocated block, possibly NULL if lru == NULL */
98
ulint size, /*!< in: block size, up to UNIV_PAGE_SIZE */
99
ibool* lru) /*!< in: pointer to a variable that will be assigned
100
TRUE if storage was allocated from the LRU list
101
and buf_pool_mutex was temporarily released,
102
or NULL if the LRU list should not be used */
101
buf_pool_t* buf_pool, /*!< in: buffer pool in which
103
ulint size, /*!< in: block size, up to
105
ibool* lru) /*!< in: pointer to a variable
106
that will be assigned TRUE if
107
storage was allocated from the
108
LRU list and buf_pool->mutex was
109
temporarily released, or NULL if
110
the LRU list should not be used */
104
ut_ad(buf_pool_mutex_own());
112
ut_ad(buf_pool_mutex_own(buf_pool));
106
return(buf_buddy_alloc_low(buf_buddy_get_slot(size), lru));
114
return(buf_buddy_alloc_low(buf_pool, buf_buddy_get_slot(size), lru));
109
117
/**********************************************************************//**
115
void* buf, /*!< in: block to be freed, must not be
116
pointed to by the buffer pool */
117
ulint size) /*!< in: block size, up to UNIV_PAGE_SIZE */
123
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
124
void* buf, /*!< in: block to be freed, must not be
125
pointed to by the buffer pool */
126
ulint size) /*!< in: block size, up to
119
ut_ad(buf_pool_mutex_own());
129
ut_ad(buf_pool_mutex_own(buf_pool));
121
buf_buddy_free_low(buf, buf_buddy_get_slot(size));
131
buf_buddy_free_low(buf_pool, buf, buf_buddy_get_slot(size));
124
134
#ifdef UNIV_MATERIALIZE