11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
Place, Suite 330, Boston, MA 02111-1307 USA
14
this program; if not, write to the Free Software Foundation, Inc.,
15
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
17
17
*****************************************************************************/
34
34
#include "page0types.h"
35
35
#include "fsp0types.h"
37
/* @defgroup fsp_flags InnoDB Tablespace Flag Constants @{ */
39
/** Number of flag bits used to indicate the tablespace page size */
40
#define FSP_FLAGS_WIDTH_PAGE_SSIZE 4
41
/** Zero relative shift position of the PAGE_SSIZE field */
42
#define FSP_FLAGS_POS_PAGE_SSIZE 6
43
/** Bit mask of the PAGE_SSIZE field */
44
#define FSP_FLAGS_MASK_PAGE_SSIZE \
45
((~(~0 << FSP_FLAGS_WIDTH_PAGE_SSIZE)) \
46
<< FSP_FLAGS_POS_PAGE_SSIZE)
47
/** Return the value of the PAGE_SSIZE field */
48
#define FSP_FLAGS_GET_PAGE_SSIZE(flags) \
49
((flags & FSP_FLAGS_MASK_PAGE_SSIZE) \
50
>> FSP_FLAGS_POS_PAGE_SSIZE)
54
/* @defgroup Tablespace Header Constants (moved from fsp0fsp.c) @{ */
56
/** Offset of the space header within a file page */
57
#define FSP_HEADER_OFFSET FIL_PAGE_DATA
59
/* The data structures in files are defined just as byte strings in C */
60
typedef byte fsp_header_t;
66
File space header data structure: this data structure is contained in the
67
first page of a space. The space for this header is reserved in every extent
68
descriptor page, but used only in the first. */
70
/*-------------------------------------*/
71
#define FSP_SPACE_ID 0 /* space id */
72
#define FSP_NOT_USED 4 /* this field contained a value up to
73
which we know that the modifications
74
in the database have been flushed to
75
the file space; not used now */
76
#define FSP_SIZE 8 /* Current size of the space in
78
#define FSP_FREE_LIMIT 12 /* Minimum page number for which the
79
free list has not been initialized:
80
the pages >= this limit are, by
81
definition, free; note that in a
82
single-table tablespace where size
83
< 64 pages, this number is 64, i.e.,
84
we have initialized the space
85
about the first extent, but have not
86
physically allocted those pages to the
88
#define FSP_SPACE_FLAGS 16 /* fsp_space_t.flags, similar to
89
dict_table_t::flags */
90
#define FSP_FRAG_N_USED 20 /* number of used pages in the
92
#define FSP_FREE 24 /* list of free extents */
93
#define FSP_FREE_FRAG (24 + FLST_BASE_NODE_SIZE)
94
/* list of partially free extents not
95
belonging to any segment */
96
#define FSP_FULL_FRAG (24 + 2 * FLST_BASE_NODE_SIZE)
97
/* list of full extents not belonging
99
#define FSP_SEG_ID (24 + 3 * FLST_BASE_NODE_SIZE)
100
/* 8 bytes which give the first unused
102
#define FSP_SEG_INODES_FULL (32 + 3 * FLST_BASE_NODE_SIZE)
103
/* list of pages containing segment
104
headers, where all the segment inode
105
slots are reserved */
106
#define FSP_SEG_INODES_FREE (32 + 4 * FLST_BASE_NODE_SIZE)
107
/* list of pages containing segment
108
headers, where not all the segment
109
header slots are reserved */
110
/*-------------------------------------*/
111
/* File space header size */
112
#define FSP_HEADER_SIZE (32 + 5 * FLST_BASE_NODE_SIZE)
114
#define FSP_FREE_ADD 4 /* this many free extents are added
115
to the free list from above
116
FSP_FREE_LIMIT at a time */
37
121
/**********************************************************************//**
38
122
Initializes the file space system. */
352
436
mtr_t* mtr); /*!< in: mtr */
353
437
#endif /* UNIV_BTR_PRINT */
439
/********************************************************************//**
440
Extract the page size from tablespace flags.
441
This feature, storing the page_ssize into the tablespace flags, is added
442
to InnoDB 5.6.4. This is here only to protect against a crash if a newer
443
database is opened with this code branch.
444
@return page size of the tablespace in bytes */
447
fsp_flags_get_page_size(
448
/*====================*/
449
ulint flags); /*!< in: tablespace flags */
355
451
#ifndef UNIV_NONINL
356
452
#include "fsp0fsp.ic"