MySQL 8.0.31
Source Code Documentation
buf0buddy.h File Reference

Binary buddy allocator for compressed pages. More...

#include "buf0types.h"
#include "univ.i"
#include "buf0buddy.ic"

Go to the source code of this file.

Functions

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...
 
bool buf_buddy_realloc (buf_pool_t *buf_pool, void *buf, ulint size)
 Try to reallocate a block. More...
 
void buf_buddy_condense_free (buf_pool_t *buf_pool)
 Combine all pairs of free buddies. 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_condense_free()

void buf_buddy_condense_free ( buf_pool_t buf_pool)

Combine all pairs of free buddies.

Parameters
[in]buf_poolbuffer pool instance

◆ 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_realloc()

bool buf_buddy_realloc ( buf_pool_t buf_pool,
void *  buf,
ulint  size 
)

Try to reallocate a block.

Parameters
[in]buf_poolbuffer pool instance
[in]bufblock to be reallocated, must be pointed to by the buffer pool
[in]sizeblock size, up to UNIV_PAGE_SIZE
Return values
trueif succeeded or if failed because the block was fixed
falseif failed because of no free blocks.