1
1
/*****************************************************************************
3
Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
3
Copyright (c) 2006, 2011, Oracle and/or its affiliates. All Rights Reserved.
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
36
36
/**********************************************************************//**
37
37
Allocate a block. The thread calling this function must hold
38
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
@return allocated block, possibly NULL if lru==NULL */
39
The buf_pool_mutex may be released and reacquired.
40
@return allocated block, never NULL */
43
43
buf_buddy_alloc_low(
46
46
or BUF_BUDDY_SIZES */
47
47
ibool* lru) /*!< in: pointer to a variable that will be assigned
48
48
TRUE if storage was allocated from the LRU list
49
and buf_pool_mutex was temporarily released,
50
or NULL if the LRU list should not be used */
51
__attribute__((malloc));
49
and buf_pool_mutex was temporarily released */
50
__attribute__((malloc, nonnull));
53
52
/**********************************************************************//**
54
53
Deallocate a block. */
84
85
/**********************************************************************//**
85
86
Allocate a block. The thread calling this function must hold
86
87
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
88
if lru != NULL. This function should only be used for allocating
89
compressed page frames or control blocks (buf_page_t). Allocated
90
control blocks must be properly initialized immediately after
91
buf_buddy_alloc() has returned the memory, before releasing
93
@return allocated block, possibly NULL if lru == NULL */
88
block->mutex. The buf_pool_mutex may be released and reacquired.
89
This function should only be used for allocating compressed page frames.
90
@return allocated block, never NULL */
98
ulint size, /*!< in: block size, up to UNIV_PAGE_SIZE */
95
ulint size, /*!< in: compressed page size
96
(between PAGE_ZIP_MIN_SIZE and UNIV_PAGE_SIZE) */
99
97
ibool* lru) /*!< in: pointer to a variable that will be assigned
100
98
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 */
99
and buf_pool_mutex was temporarily released */
104
101
ut_ad(buf_pool_mutex_own());
102
ut_ad(ut_is_2pow(size));
103
ut_ad(size >= PAGE_ZIP_MIN_SIZE);
104
ut_ad(size <= UNIV_PAGE_SIZE);
106
return(buf_buddy_alloc_low(buf_buddy_get_slot(size), lru));
106
return((byte*) buf_buddy_alloc_low(buf_buddy_get_slot(size), lru));
109
109
/**********************************************************************//**
117
117
ulint size) /*!< in: block size, up to UNIV_PAGE_SIZE */
119
119
ut_ad(buf_pool_mutex_own());
120
ut_ad(ut_is_2pow(size));
121
ut_ad(size >= PAGE_ZIP_MIN_SIZE);
122
ut_ad(size <= UNIV_PAGE_SIZE);
121
124
buf_buddy_free_low(buf, buf_buddy_get_slot(size));