1 /*****************************************************************************
2 
3 Copyright (c) 1995, 2009, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License, version 2.0,
7 as published by the Free Software Foundation.
8 
9 This program is also distributed with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation.  The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have included with MySQL.
15 
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 GNU General Public License, version 2.0, for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
24 
25 *****************************************************************************/
26 
27 /******************************************************
28 @file include/fsp0types.h
29 File space management types
30 
31 Created May 26, 2009 Vasil Dimov
32 *******************************************************/
33 
34 #ifndef fsp0types_h
35 #define fsp0types_h
36 
37 #include "univ.i"
38 
39 #include "fil0fil.h" /* for FIL_PAGE_DATA */
40 
41 /** @name Flags for inserting records in order
42 If records are inserted in order, there are the following
43 flags to tell this (their type is made byte for the compiler
44 to warn if direction and hint parameters are switched in
45 fseg_alloc_free_page) */
46 /* @{ */
47 #define	FSP_UP		((byte)111)	/*!< alphabetically upwards */
48 #define	FSP_DOWN	((byte)112)	/*!< alphabetically downwards */
49 #define	FSP_NO_DIR	((byte)113)	/*!< no order */
50 /* @} */
51 
52 /** File space extent size (one megabyte) in pages */
53 #define	FSP_EXTENT_SIZE		(1048576U / UNIV_PAGE_SIZE)
54 
55 /** File space extent size (one megabyte) in pages for MAX page size */
56 #define	FSP_EXTENT_SIZE_MAX	(1048576 / UNIV_PAGE_SIZE_MAX)
57 
58 /** File space extent size (one megabyte) in pages for MIN page size */
59 #define	FSP_EXTENT_SIZE_MIN	(1048576 / UNIV_PAGE_SIZE_MIN)
60 
61 /** On a page of any file segment, data may be put starting from this
62 offset */
63 #define FSEG_PAGE_DATA		FIL_PAGE_DATA
64 
65 /** @name File segment header
66 The file segment header points to the inode describing the file segment. */
67 /* @{ */
68 /** Data type for file segment header */
69 typedef	byte	fseg_header_t;
70 
71 #define FSEG_HDR_SPACE		0	/*!< space id of the inode */
72 #define FSEG_HDR_PAGE_NO	4	/*!< page number of the inode */
73 #define FSEG_HDR_OFFSET		8	/*!< byte offset of the inode */
74 
75 #define FSEG_HEADER_SIZE	10	/*!< Length of the file system
76 					header, in bytes */
77 /* @} */
78 
79 /** Flags for fsp_reserve_free_extents @{ */
80 #define FSP_NORMAL	1000000
81 #define	FSP_UNDO	2000000
82 #define FSP_CLEANING	3000000
83 /* @} */
84 
85 /* Number of pages described in a single descriptor page: currently each page
86 description takes less than 1 byte; a descriptor page is repeated every
87 this many file pages */
88 /* #define XDES_DESCRIBED_PER_PAGE		UNIV_PAGE_SIZE */
89 /* This has been replaced with either UNIV_PAGE_SIZE or page_zip->size. */
90 
91 /** @name The space low address page map
92 The pages at FSP_XDES_OFFSET and FSP_IBUF_BITMAP_OFFSET are repeated
93 every XDES_DESCRIBED_PER_PAGE pages in every tablespace. */
94 /* @{ */
95 /*--------------------------------------*/
96 #define FSP_XDES_OFFSET			0	/* !< extent descriptor */
97 #define FSP_IBUF_BITMAP_OFFSET		1	/* !< insert buffer bitmap */
98 				/* The ibuf bitmap pages are the ones whose
99 				page number is the number above plus a
100 				multiple of XDES_DESCRIBED_PER_PAGE */
101 
102 #define FSP_FIRST_INODE_PAGE_NO		2	/*!< in every tablespace */
103 				/* The following pages exist
104 				in the system tablespace (space 0). */
105 #define FSP_IBUF_HEADER_PAGE_NO		3	/*!< insert buffer
106 						header page, in
107 						tablespace 0 */
108 #define FSP_IBUF_TREE_ROOT_PAGE_NO	4	/*!< insert buffer
109 						B-tree root page in
110 						tablespace 0 */
111 				/* The ibuf tree root page number in
112 				tablespace 0; its fseg inode is on the page
113 				number FSP_FIRST_INODE_PAGE_NO */
114 #define FSP_TRX_SYS_PAGE_NO		5	/*!< transaction
115 						system header, in
116 						tablespace 0 */
117 #define	FSP_FIRST_RSEG_PAGE_NO		6	/*!< first rollback segment
118 						page, in tablespace 0 */
119 #define FSP_DICT_HDR_PAGE_NO		7	/*!< data dictionary header
120 						page, in tablespace 0 */
121 /*--------------------------------------*/
122 /* @} */
123 
124 #endif /* fsp0types_h */
125