~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/buf0buddy.ic

  • Committer: Monty Taylor
  • Date: 2010-11-26 22:50:54 UTC
  • mfrom: (1953.1.6 build)
  • Revision ID: mordred@inaugust.com-20101126225054-sg90svw8579t5p3i
Stewart - InnoDB 1.1.1
Monty - Fixed some autoconf tests which were returning false positives.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
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 */
41
41
UNIV_INTERN
42
42
void*
43
43
buf_buddy_alloc_low(
44
44
/*================*/
 
45
        buf_pool_t*     buf_pool,
 
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));
52
54
 
56
58
void
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[],
62
 
                        or BUF_BUDDY_SIZES */
 
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[],
 
65
                                        or BUF_BUDDY_SIZES */
63
66
        __attribute__((nonnull));
64
67
 
65
68
/**********************************************************************//**
83
86
 
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
92
 
buf_pool_mutex.
 
95
buf_pool->mutex.
93
96
@return allocated block, possibly NULL if lru == NULL */
94
97
UNIV_INLINE
95
98
void*
96
99
buf_buddy_alloc(
97
100
/*============*/
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
 
102
                                        the page resides */
 
103
        ulint           size,           /*!< in: block size, up to
 
104
                                        UNIV_PAGE_SIZE */
 
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 */
103
111
{
104
 
        ut_ad(buf_pool_mutex_own());
 
112
        ut_ad(buf_pool_mutex_own(buf_pool));
105
113
 
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));
107
115
}
108
116
 
109
117
/**********************************************************************//**
112
120
void
113
121
buf_buddy_free(
114
122
/*===========*/
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
 
127
                                        UNIV_PAGE_SIZE */
118
128
{
119
 
        ut_ad(buf_pool_mutex_own());
 
129
        ut_ad(buf_pool_mutex_own(buf_pool));
120
130
 
121
 
        buf_buddy_free_low(buf, buf_buddy_get_slot(size));
 
131
        buf_buddy_free_low(buf_pool, buf, buf_buddy_get_slot(size));
122
132
}
123
133
 
124
134
#ifdef UNIV_MATERIALIZE