InnoDB Plugin  1.0
Functions
buf0buddy.ic File Reference
#include "buf0buf.h"
#include "buf0buddy.h"
#include "ut0ut.h"
#include "sync0sync.h"
Include dependency graph for buf0buddy.ic:
This graph shows which files directly or indirectly include this file:

Functions

UNIV_INTERN void * buf_buddy_alloc_low (buf_pool_t *buf_pool, ulint i, ibool *lru))
UNIV_INTERN void buf_buddy_free_low (buf_pool_t *buf_pool, void *buf, ulint i))
UNIV_INLINE ulint buf_buddy_get_slot (ulint size)
UNIV_INLINE byte * buf_buddy_alloc (buf_pool_t *buf_pool, ulint size, ibool *lru)
UNIV_INLINE void buf_buddy_free (buf_pool_t *buf_pool, void *buf, ulint size)

Detailed Description

Binary buddy allocator for compressed pages

Created December 2006 by Marko Makela

Function Documentation

UNIV_INLINE byte* buf_buddy_alloc ( buf_pool_t buf_pool,
ulint  size,
ibool lru 
)

Allocate a block. The thread calling this function must hold buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex. The buf_pool->mutex may be released and reacquired. This function should only be used for allocating compressed page frames.

Returns
allocated block, never NULL
Parameters
buf_poolin/out: buffer pool in which the page resides
sizein: compressed page size (between UNIV_ZIP_SIZE_MIN and UNIV_PAGE_SIZE)
lruin: pointer to a variable that will be assigned TRUE if storage was allocated from the LRU list and buf_pool->mutex was temporarily released
UNIV_INTERN void* buf_buddy_alloc_low ( buf_pool_t buf_pool,
ulint  i,
ibool lru 
)

Allocate a block. The thread calling this function must hold buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex. The buf_pool_mutex may be released and reacquired.

Returns
allocated block, never NULL
Parameters
buf_poolin/out: buffer pool instance
iin: index of buf_pool->zip_free[], or BUF_BUDDY_SIZES
lruin: pointer to a variable that will be assigned TRUE if storage was allocated from the LRU list and buf_pool->mutex was temporarily released
UNIV_INLINE void buf_buddy_free ( buf_pool_t buf_pool,
void *  buf,
ulint  size 
)

Deallocate a block.

Parameters
buf_poolin/out: buffer pool in which the block resides
bufin: block to be freed, must not be pointed to by the buffer pool
sizein: block size, up to UNIV_PAGE_SIZE
UNIV_INTERN void buf_buddy_free_low ( buf_pool_t buf_pool,
void *  buf,
ulint  i 
)

Deallocate a block.

Parameters
buf_poolin: buffer pool instance
bufin: block to be freed, must not be pointed to by the buffer pool
iin: index of buf_pool->zip_free[], or BUF_BUDDY_SIZES
UNIV_INLINE ulint buf_buddy_get_slot ( ulint  size)

Get the index of buf_pool->zip_free[] for a given block size.

Returns
index of buf_pool->zip_free[], or BUF_BUDDY_SIZES
Parameters
sizein: block size