~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Lee Bieber
  • Date: 2010-11-14 23:15:42 UTC
  • mfrom: (1929.1.42 warning-stack-frame)
  • Revision ID: kalebral@gmail.com-20101114231542-fnnu6ydd2p17n582
Merge Monty - fix bug 672372: some functions use > 32k stack

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 2006, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
4
4
 
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
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 */
47
45
        ulint   i,      /*!< in: index of buf_pool->zip_free[],
48
46
                        or BUF_BUDDY_SIZES */
49
47
        ibool*  lru)    /*!< in: pointer to a variable that will be assigned
50
48
                        TRUE if storage was allocated from the LRU list
51
 
                        and buf_pool->mutex was temporarily released,
 
49
                        and buf_pool_mutex was temporarily released,
52
50
                        or NULL if the LRU list should not be used */
53
51
        __attribute__((malloc));
54
52
 
58
56
void
59
57
buf_buddy_free_low(
60
58
/*===============*/
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 */
 
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 */
66
63
        __attribute__((nonnull));
67
64
 
68
65
/**********************************************************************//**
86
83
 
87
84
/**********************************************************************//**
88
85
Allocate a block.  The thread calling this function must hold
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
 
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
91
88
if lru != NULL.  This function should only be used for allocating
92
89
compressed page frames or control blocks (buf_page_t).  Allocated
93
90
control blocks must be properly initialized immediately after
94
91
buf_buddy_alloc() has returned the memory, before releasing
95
 
buf_pool->mutex.
 
92
buf_pool_mutex.
96
93
@return allocated block, possibly NULL if lru == NULL */
97
94
UNIV_INLINE
98
95
void*
99
96
buf_buddy_alloc(
100
97
/*============*/
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 */
 
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 */
111
103
{
112
 
        ut_ad(buf_pool_mutex_own(buf_pool));
 
104
        ut_ad(buf_pool_mutex_own());
113
105
 
114
 
        return(buf_buddy_alloc_low(buf_pool, buf_buddy_get_slot(size), lru));
 
106
        return(buf_buddy_alloc_low(buf_buddy_get_slot(size), lru));
115
107
}
116
108
 
117
109
/**********************************************************************//**
120
112
void
121
113
buf_buddy_free(
122
114
/*===========*/
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 */
 
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 */
128
118
{
129
 
        ut_ad(buf_pool_mutex_own(buf_pool));
 
119
        ut_ad(buf_pool_mutex_own());
130
120
 
131
 
        buf_buddy_free_low(buf_pool, buf, buf_buddy_get_slot(size));
 
121
        buf_buddy_free_low(buf, buf_buddy_get_slot(size));
132
122
}
133
123
 
134
124
#ifdef UNIV_MATERIALIZE