MySQL 9.0.0
Source Code Documentation
buf0buddy.ic File Reference

Binary buddy allocator for compressed pages. More...

#include "buf0buddy.h"
#include "buf0buf.h"

Functions

void * buf_buddy_alloc_low (buf_pool_t *buf_pool, ulint i)
 Allocate a block. More...
 
void buf_buddy_free_low (buf_pool_t *buf_pool, void *buf, ulint i, bool has_zip_free)
 Deallocate a block. More...
 
static ulint buf_buddy_get_slot (ulint size)
 Get the index of buf_pool->zip_free[] for a given block size. More...
 
static bytebuf_buddy_alloc (buf_pool_t *buf_pool, ulint size)
 Allocate a block. More...
 
static void buf_buddy_free (buf_pool_t *buf_pool, void *buf, ulint size)
 Deallocate a block. More...
 

Detailed Description

Binary buddy allocator for compressed pages.

Created December 2006 by Marko Makela

Function Documentation

◆ buf_buddy_alloc()

static byte * buf_buddy_alloc ( buf_pool_t buf_pool,
ulint  size 
)
inlinestatic

Allocate a block.

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

Parameters
[in,out]buf_poolbuffer pool in which the page resides
[in]sizecompressed page size, between UNIV_ZIP_SIZE_MIN and UNIV_PAGE_SIZE
Returns
allocated block, never NULL

◆ buf_buddy_alloc_low()

void * buf_buddy_alloc_low ( buf_pool_t buf_pool,
ulint  i 
)

Allocate a block.

Parameters
[in,out]buf_poolbuffer pool instance
[in]iindex of buf_pool->zip_free[] or BUF_BUDDY_SIZES
Returns
allocated block, never NULL

◆ buf_buddy_free()

static void buf_buddy_free ( buf_pool_t buf_pool,
void *  buf,
ulint  size 
)
inlinestatic

Deallocate a block.

Parameters
[in,out]buf_poolbuffer pool in which the block resides
[in]bufblock to be freed, must not be pointed to by the buffer pool
[in]sizeblock size, up to UNIV_PAGE_SIZE

◆ buf_buddy_free_low()

void buf_buddy_free_low ( buf_pool_t buf_pool,
void *  buf,
ulint  i,
bool  has_zip_free 
)

Deallocate a block.

Parameters
[in]buf_poolbuffer pool instance
[in]bufblock to be freed, must not be pointed to by the buffer pool
[in]iindex of buf_pool->zip_free[], or BUF_BUDDY_SIZES
[in]has_zip_freewhether has zip_free_mutex

◆ buf_buddy_get_slot()

static ulint buf_buddy_get_slot ( ulint  size)
inlinestatic

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