MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fsp0fsp.cc File Reference
#include "fsp0fsp.h"
#include "buf0buf.h"
#include "fil0fil.h"
#include "mtr0log.h"
#include "ut0byte.h"
#include "page0page.h"
#include "page0zip.h"
#include "sync0sync.h"
#include "fut0fut.h"
#include "srv0srv.h"
#include "ibuf0ibuf.h"
#include "btr0btr.h"
#include "btr0sea.h"
#include "dict0boot.h"
#include "log0log.h"
#include "dict0mem.h"
#include "srv0start.h"
Include dependency graph for fsp0fsp.cc:

Go to the source code of this file.

Functions

UNIV_INTERN ulint fsp_get_size_low (page_t *page)
UNIV_INLINE fsp_header_t * fsp_get_space_header (ulint id, ulint zip_size, mtr_t *mtr)
UNIV_INLINE ibool xdes_mtr_get_bit (const xdes_t *descr, ulint bit, ulint offset, mtr_t *mtr)
UNIV_INLINE void xdes_set_bit (xdes_t *descr, ulint bit, ulint offset, ibool val, mtr_t *mtr)
UNIV_INLINE ulint xdes_find_bit (xdes_t *descr, ulint bit, ibool val, ulint hint, mtr_t *mtr)
UNIV_INLINE ulint xdes_find_bit_downward (xdes_t *descr, ulint bit, ibool val, ulint hint, mtr_t *mtr)
UNIV_INLINE ulint xdes_get_n_used (const xdes_t *descr, mtr_t *mtr)
UNIV_INLINE ibool xdes_is_free (const xdes_t *descr, mtr_t *mtr)
UNIV_INLINE ibool xdes_is_full (const xdes_t *descr, mtr_t *mtr)
UNIV_INLINE void xdes_set_state (xdes_t *descr, ulint state, mtr_t *mtr)
UNIV_INLINE ulint xdes_get_state (const xdes_t *descr, mtr_t *mtr)
UNIV_INLINE void xdes_init (xdes_t *descr, mtr_t *mtr)
UNIV_INLINE __attribute__ ((nonnull, warn_unused_result)) xdes_t *xdes_get_descriptor_with_space_hdr(fsp_header_t *sp_header
 ut_ad (mtr_memo_contains(mtr, fil_space_get_latch(space, NULL), MTR_MEMO_X_LOCK))
 ut_ad (mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_X_FIX))
 ut_ad (page_offset(sp_header)==FSP_HEADER_OFFSET)
 if ((offset >=size)||(offset >=limit))
 if (descr_page_no==0)

Variables

static ulint page
static ulint xdes_t * descr
static ulint xdes_t mtr_tmtr
static buf_block_t nonnull
UNIV_INLINE ulint space
UNIV_INLINE ulint ulint offset
UNIV_INLINE ulint ulint mtr_t
*mtr ulint 
limit = mach_read_from_4(sp_header + FSP_FREE_LIMIT)
ulint size = mach_read_from_4(sp_header + FSP_SIZE)
ulint zip_size
ulint descr_page_no = xdes_calc_descriptor_page(zip_size, offset)
page_tdescr_page

Detailed Description

File space management

Created 11/29/1995 Heikki Tuuri

Definition in file fsp0fsp.cc.

Function Documentation

static __attribute__ ( (nonnull, warn_unused_result)  )

Gets pointer to a the extent descriptor of a page. The page where the extent descriptor resides is x-locked. This function no longer extends the data file.

Returns
pointer to the extent descriptor, NULL if the page does not exist in the space or if the offset is >= the free limit

Gets pointer to a the extent descriptor of a page. The page where the extent descriptor resides is x-locked. If the page offset is equal to the free limit of the space, adds new extents from above the free limit to the space free list, if not free limit == space size. This adding is necessary to make the descriptor defined, as they are uninitialized above the free limit.

Returns
pointer to the extent descriptor, NULL if the page does not exist in the space or if the offset exceeds the free limit

Removes a secondary index entry if found.

Returns
DB_SUCCESS, DB_FAIL, or DB_OUT_OF_FILE_SPACE

Opens a log file.

Returns
DB_SUCCESS or error code
UNIV_INTERN ulint fsp_get_size_low ( page_t page)

Reads the file space size stored in the header page.

Returns
tablespace size stored in the space header
Parameters
pagein: header page (page 0 in the tablespace)

Definition at line 172 of file fsp0fsp.cc.

Here is the call graph for this function:

UNIV_INLINE fsp_header_t* fsp_get_space_header ( ulint  id,
ulint  zip_size,
mtr_t mtr 
)

Gets a pointer to the space header and x-locks its page.

Returns
pointer to the space header, page x-locked
Parameters
idin: space id
zip_sizein: compressed page size in bytes or 0 for uncompressed pages
mtrin/out: mini-transaction

Definition at line 185 of file fsp0fsp.cc.

Here is the call graph for this function:

UNIV_INLINE ulint xdes_find_bit ( xdes_t *  descr,
ulint  bit,
ibool  val,
ulint  hint,
mtr_t mtr 
)

Looks for a descriptor bit having the desired value. Starts from hint and scans upward; at the end of the extent the search is wrapped to the start of the extent.

Returns
bit index of the bit, ULINT_UNDEFINED if not found
Parameters
descrin: descriptor
bitin: XDES_FREE_BIT or XDES_CLEAN_BIT
valin: desired bit value
hintin: hint of which bit position would be desirable
mtrin/out: mini-transaction

Definition at line 271 of file fsp0fsp.cc.

Here is the call graph for this function:

UNIV_INLINE ulint xdes_find_bit_downward ( xdes_t *  descr,
ulint  bit,
ibool  val,
ulint  hint,
mtr_t mtr 
)

Looks for a descriptor bit having the desired value. Scans the extent in a direction opposite to xdes_find_bit.

Returns
bit index of the bit, ULINT_UNDEFINED if not found
Parameters
descrin: descriptor
bitin: XDES_FREE_BIT or XDES_CLEAN_BIT
valin: desired bit value
hintin: hint of which bit position would be desirable
mtrin/out: mini-transaction

Definition at line 309 of file fsp0fsp.cc.

Here is the call graph for this function:

UNIV_INLINE ulint xdes_get_n_used ( const xdes_t *  descr,
mtr_t mtr 
)

Returns the number of used pages in a descriptor.

Returns
number of pages used
Parameters
descrin: descriptor
mtrin/out: mini-transaction

Definition at line 346 of file fsp0fsp.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE ulint xdes_get_state ( const xdes_t *  descr,
mtr_t mtr 
)

Gets the state of an xdes.

Returns
state
Parameters
descrin: descriptor
mtrin/out: mini-transaction

Definition at line 423 of file fsp0fsp.cc.

Here is the call graph for this function:

UNIV_INLINE void xdes_init ( xdes_t *  descr,
mtr_t mtr 
)

Inits an extent descriptor to the free and clean state.

Parameters
descrin: descriptor
mtrin/out: mini-transaction

Definition at line 442 of file fsp0fsp.cc.

Here is the call graph for this function:

UNIV_INLINE ibool xdes_is_free ( const xdes_t *  descr,
mtr_t mtr 
)

Returns true if extent contains no used pages.

Returns
TRUE if totally free
Parameters
descrin: descriptor
mtrin/out: mini-transaction

Definition at line 369 of file fsp0fsp.cc.

Here is the call graph for this function:

UNIV_INLINE ibool xdes_is_full ( const xdes_t *  descr,
mtr_t mtr 
)

Returns true if extent contains no free pages.

Returns
TRUE if full
Parameters
descrin: descriptor
mtrin/out: mini-transaction

Definition at line 387 of file fsp0fsp.cc.

Here is the call graph for this function:

UNIV_INLINE ibool xdes_mtr_get_bit ( const xdes_t *  descr,
ulint  bit,
ulint  offset,
mtr_t mtr 
)

Gets a descriptor bit of a page.

Returns
TRUE if free
Parameters
descrin: descriptor
bitin: XDES_FREE_BIT or XDES_CLEAN_BIT
offsetin: page offset within extent: 0 ... FSP_EXTENT_SIZE - 1
mtrin: mini-transaction

Definition at line 215 of file fsp0fsp.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE void xdes_set_bit ( xdes_t *  descr,
ulint  bit,
ulint  offset,
ibool  val,
mtr_t mtr 
)

Sets a descriptor bit of a page.

Parameters
descrin: descriptor
bitin: XDES_FREE_BIT or XDES_CLEAN_BIT
offsetin: page offset within extent: 0 ... FSP_EXTENT_SIZE - 1
valin: bit value
mtrin/out: mini-transaction

Definition at line 233 of file fsp0fsp.cc.

Here is the call graph for this function:

UNIV_INLINE void xdes_set_state ( xdes_t *  descr,
ulint  state,
mtr_t mtr 
)

Sets the state of an xdes.

Parameters
descrin/out: descriptor
statein: state to set
mtrin/out: mini-transaction

Definition at line 404 of file fsp0fsp.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

ulint xdes_t* descr

in: extent descriptor

Definition at line 101 of file fsp0fsp.cc.

limit = mach_read_from_4(sp_header + FSP_FREE_LIMIT)

< in/out: mini-transaction

Definition at line 472 of file fsp0fsp.cc.

ulint xdes_t mtr_t* mtr

in/out: mini-transaction

Definition at line 101 of file fsp0fsp.cc.

ulint ulint offset

in: page offset; if equal to the free limit, we try to add new extents to the space free list

Definition at line 472 of file fsp0fsp.cc.

ulint page

< in: segment inode in: page offset

Definition at line 101 of file fsp0fsp.cc.

UNIV_INLINE ulint space

< in/out: space header, x-latched in mtr in: space id

Definition at line 472 of file fsp0fsp.cc.

ulint zip_size
Initial value:
mach_read_from_4(sp_header + FSP_SPACE_FLAGS))

< in: space id in: compressed page size in bytes or 0 for uncompressed pages

Definition at line 481 of file fsp0fsp.cc.