1
1
/*****************************************************************************
3
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
3
Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
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
30
30
#include "ut0byte.h"
31
31
#include "buf0types.h"
33
/** The return type of buf_LRU_free_block() */
34
enum buf_lru_free_block_status {
37
/** not freed because the caller asked to remove the
38
uncompressed frame but the control block cannot be
40
BUF_LRU_CANNOT_RELOCATE,
41
/** not freed because of some other reason */
45
33
/******************************************************************//**
46
34
Tries to remove LRU flushed blocks from the end of the LRU list and put them
47
35
to the free list. This is beneficial for the efficiency of the insert buffer
84
72
buf_LRU_invalidate_tablespace(
85
73
/*==========================*/
86
74
ulint id); /*!< in: space id */
75
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
87
76
/********************************************************************//**
88
77
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
91
80
buf_LRU_insert_zip_clean(
92
81
/*=====================*/
93
82
buf_page_t* bpage); /*!< in: pointer to the block in question */
83
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
95
85
/******************************************************************//**
96
86
Try to free a block. If bpage is a descriptor of a compressed-only
97
87
page, the descriptor object will be freed as well.
99
NOTE: If this function returns BUF_LRU_FREED, it will temporarily
89
NOTE: If this function returns TRUE, it will temporarily
100
90
release buf_pool_mutex. Furthermore, the page frame will no longer be
101
91
accessible via bpage.
103
93
The caller must hold buf_pool_mutex and buf_page_get_mutex(bpage) and
104
94
release these two mutexes after the call. No other
105
95
buf_page_get_mutex() may be held when calling this function.
106
@return BUF_LRU_FREED if freed, BUF_LRU_CANNOT_RELOCATE or
107
BUF_LRU_NOT_FREED otherwise. */
96
@return TRUE if freed, FALSE otherwise. */
109
enum buf_lru_free_block_status
110
99
buf_LRU_free_block(
111
100
/*===============*/
112
101
buf_page_t* bpage, /*!< in: block to be freed */
113
ibool zip, /*!< in: TRUE if should remove also the
102
ibool zip) /*!< in: TRUE if should remove also the
114
103
compressed page of an uncompressed page */
115
ibool* buf_pool_mutex_released);
116
/*!< in: pointer to a variable that will
117
be assigned TRUE if buf_pool_mutex
118
was temporarily released, or NULL */
104
__attribute__((nonnull));
119
105
/******************************************************************//**
120
106
Try to free a replaceable block.
121
107
@return TRUE if found and freed */
146
132
@return the free control block, in state BUF_BLOCK_READY_FOR_USE */
149
buf_LRU_get_free_block(
150
/*===================*/
151
ulint zip_size); /*!< in: compressed page size in bytes,
152
or 0 if uncompressed tablespace */
135
buf_LRU_get_free_block(void)
136
/*========================*/
137
__attribute__((warn_unused_result));
154
139
/******************************************************************//**
155
140
Puts a block back to the free list. */