Drizzled Public API Documentation

buf0buddy.h File Reference
#include "univ.i"
#include "buf0types.h"

Go to the source code of this file.

Functions

UNIV_INLINE void * buf_buddy_alloc (buf_pool_t *buf_pool, ulint size, ibool *lru) __attribute__((malloc))
 
UNIV_INLINE void buf_buddy_free (buf_pool_t *buf_pool, void *buf, ulint size) __attribute__((nonnull))
 

Detailed Description

Binary buddy allocator for compressed pages

Created December 2006 by Marko Makela

Definition in file buf0buddy.h.

Function Documentation

UNIV_INLINE void* 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 only be released and reacquired if lru != NULL. This function should only be used for allocating compressed page frames or control blocks (buf_page_t). Allocated control blocks must be properly initialized immediately after buf_buddy_alloc() has returned the memory, before releasing buf_pool->mutex.

Returns
allocated block, possibly NULL if lru == NULL
Parameters
buf_poolbuffer pool in which the block resides
sizein: block size, up to 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, or NULL if the LRU list should not be used

Referenced by buf_LRU_free_block(), buf_LRU_get_free_block(), buf_page_create(), and buf_page_init_for_read().

UNIV_INLINE void buf_buddy_free ( buf_pool_t buf_pool,
void *  buf,
ulint  size 
)

Release a block.

Parameters
buf_poolbuffer 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

Referenced by buf_LRU_block_free_non_file_page(), buf_page_get_gen(), and buf_page_init_for_read().