31 #ifndef UNIV_INNOCHECKSUM
37 #include "fsp0types.h"
44 #define FSP_FLAGS_WIDTH_POST_ANTELOPE 1
46 #define FSP_FLAGS_WIDTH_ZIP_SSIZE 4
50 #define FSP_FLAGS_WIDTH_ATOMIC_BLOBS 1
52 #define FSP_FLAGS_WIDTH_PAGE_SSIZE 4
55 #define FSP_FLAGS_WIDTH_DATA_DIR 1
57 #define FSP_FLAGS_WIDTH (FSP_FLAGS_WIDTH_POST_ANTELOPE \
58 + FSP_FLAGS_WIDTH_ZIP_SSIZE \
59 + FSP_FLAGS_WIDTH_ATOMIC_BLOBS \
60 + FSP_FLAGS_WIDTH_PAGE_SSIZE \
61 + FSP_FLAGS_WIDTH_DATA_DIR)
64 #define FSP_FLAGS_MASK (~(~0 << FSP_FLAGS_WIDTH))
67 #define FSP_FLAGS_POS_POST_ANTELOPE 0
69 #define FSP_FLAGS_POS_ZIP_SSIZE (FSP_FLAGS_POS_POST_ANTELOPE \
70 + FSP_FLAGS_WIDTH_POST_ANTELOPE)
72 #define FSP_FLAGS_POS_ATOMIC_BLOBS (FSP_FLAGS_POS_ZIP_SSIZE \
73 + FSP_FLAGS_WIDTH_ZIP_SSIZE)
75 #define FSP_FLAGS_POS_PAGE_SSIZE (FSP_FLAGS_POS_ATOMIC_BLOBS \
76 + FSP_FLAGS_WIDTH_ATOMIC_BLOBS)
78 #define FSP_FLAGS_POS_DATA_DIR (FSP_FLAGS_POS_PAGE_SSIZE \
79 + FSP_FLAGS_WIDTH_PAGE_SSIZE)
81 #define FSP_FLAGS_POS_UNUSED (FSP_FLAGS_POS_DATA_DIR \
82 + FSP_FLAGS_WIDTH_DATA_DIR)
85 #define FSP_FLAGS_MASK_POST_ANTELOPE \
86 ((~(~0 << FSP_FLAGS_WIDTH_POST_ANTELOPE)) \
87 << FSP_FLAGS_POS_POST_ANTELOPE)
89 #define FSP_FLAGS_MASK_ZIP_SSIZE \
90 ((~(~0 << FSP_FLAGS_WIDTH_ZIP_SSIZE)) \
91 << FSP_FLAGS_POS_ZIP_SSIZE)
93 #define FSP_FLAGS_MASK_ATOMIC_BLOBS \
94 ((~(~0 << FSP_FLAGS_WIDTH_ATOMIC_BLOBS)) \
95 << FSP_FLAGS_POS_ATOMIC_BLOBS)
97 #define FSP_FLAGS_MASK_PAGE_SSIZE \
98 ((~(~0 << FSP_FLAGS_WIDTH_PAGE_SSIZE)) \
99 << FSP_FLAGS_POS_PAGE_SSIZE)
101 #define FSP_FLAGS_MASK_DATA_DIR \
102 ((~(~0 << FSP_FLAGS_WIDTH_DATA_DIR)) \
103 << FSP_FLAGS_POS_DATA_DIR)
106 #define FSP_FLAGS_GET_POST_ANTELOPE(flags) \
107 ((flags & FSP_FLAGS_MASK_POST_ANTELOPE) \
108 >> FSP_FLAGS_POS_POST_ANTELOPE)
110 #define FSP_FLAGS_GET_ZIP_SSIZE(flags) \
111 ((flags & FSP_FLAGS_MASK_ZIP_SSIZE) \
112 >> FSP_FLAGS_POS_ZIP_SSIZE)
114 #define FSP_FLAGS_HAS_ATOMIC_BLOBS(flags) \
115 ((flags & FSP_FLAGS_MASK_ATOMIC_BLOBS) \
116 >> FSP_FLAGS_POS_ATOMIC_BLOBS)
118 #define FSP_FLAGS_GET_PAGE_SSIZE(flags) \
119 ((flags & FSP_FLAGS_MASK_PAGE_SSIZE) \
120 >> FSP_FLAGS_POS_PAGE_SSIZE)
122 #define FSP_FLAGS_HAS_DATA_DIR(flags) \
123 ((flags & FSP_FLAGS_MASK_DATA_DIR) \
124 >> FSP_FLAGS_POS_DATA_DIR)
126 #define FSP_FLAGS_GET_UNUSED(flags) \
127 (flags >> FSP_FLAGS_POS_UNUSED)
131 #define FSP_FLAGS_SET_PAGE_SSIZE(flags, ssize) \
132 (flags | (ssize << FSP_FLAGS_POS_PAGE_SSIZE))
139 #define FSP_HEADER_OFFSET FIL_PAGE_DATA
142 typedef byte fsp_header_t;
153 #define FSP_SPACE_ID 0
154 #define FSP_NOT_USED 4
160 #define FSP_FREE_LIMIT 12
170 #define FSP_SPACE_FLAGS 16
172 #define FSP_FRAG_N_USED 20
175 #define FSP_FREE_FRAG (24 + FLST_BASE_NODE_SIZE)
178 #define FSP_FULL_FRAG (24 + 2 * FLST_BASE_NODE_SIZE)
181 #define FSP_SEG_ID (24 + 3 * FLST_BASE_NODE_SIZE)
184 #define FSP_SEG_INODES_FULL (32 + 3 * FLST_BASE_NODE_SIZE)
188 #define FSP_SEG_INODES_FREE (32 + 4 * FLST_BASE_NODE_SIZE)
194 #define FSP_HEADER_SIZE (32 + 5 * FLST_BASE_NODE_SIZE)
196 #define FSP_FREE_ADD 4
201 #ifndef UNIV_INNOCHECKSUM
213 typedef byte fseg_inode_t;
215 #define FSEG_INODE_PAGE_NODE FSEG_PAGE_DATA
219 #define FSEG_ARR_OFFSET (FSEG_PAGE_DATA + FLST_NODE_SIZE)
223 #define FSEG_NOT_FULL_N_USED 8
229 #define FSEG_NOT_FULL (12 + FLST_BASE_NODE_SIZE)
231 #define FSEG_FULL (12 + 2 * FLST_BASE_NODE_SIZE)
233 #define FSEG_MAGIC_N (12 + 3 * FLST_BASE_NODE_SIZE)
235 #define FSEG_FRAG_ARR (16 + 3 * FLST_BASE_NODE_SIZE)
239 #define FSEG_FRAG_ARR_N_SLOTS (FSP_EXTENT_SIZE / 2)
242 #define FSEG_FRAG_SLOT_SIZE 4
246 #define FSEG_INODE_SIZE \
247 (16 + 3 * FLST_BASE_NODE_SIZE \
248 + FSEG_FRAG_ARR_N_SLOTS * FSEG_FRAG_SLOT_SIZE)
250 #define FSP_SEG_INODES_PER_PAGE(zip_size) \
251 (((zip_size ? zip_size : UNIV_PAGE_SIZE) \
252 - FSEG_ARR_OFFSET - 10) / FSEG_INODE_SIZE)
256 #define FSEG_MAGIC_N_VALUE 97937874
258 #define FSEG_FILLFACTOR 8
268 #define FSEG_FRAG_LIMIT FSEG_FRAG_ARR_N_SLOTS
275 #define FSEG_FREE_LIST_LIMIT 40
280 #define FSEG_FREE_LIST_MAX_LEN 4
294 #define XDES_FLST_NODE 8
296 #define XDES_STATE (FLST_NODE_SIZE + 8)
299 #define XDES_BITMAP (FLST_NODE_SIZE + 12)
304 #define XDES_BITS_PER_PAGE 2
305 #define XDES_FREE_BIT 0
307 #define XDES_CLEAN_BIT 1
313 #define XDES_FREE_FRAG 2
315 #define XDES_FULL_FRAG 3
322 + UT_BITS_IN_BYTES(FSP_EXTENT_SIZE * XDES_BITS_PER_PAGE))
325 #define XDES_SIZE_MAX \
327 + UT_BITS_IN_BYTES(FSP_EXTENT_SIZE_MAX * XDES_BITS_PER_PAGE))
330 #define XDES_SIZE_MIN \
332 + UT_BITS_IN_BYTES(FSP_EXTENT_SIZE_MIN * XDES_BITS_PER_PAGE))
335 #define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE)
449 ibool has_done_reservation,
464 fseg_header_t* header,
480 #define fseg_alloc_free_page(seg_header, hint, direction, mtr) \
481 fseg_alloc_free_page_general(seg_header, hint, direction, \
495 fseg_header_t* seg_header,
503 ibool has_done_reservation,
513 __attribute__((warn_unused_result, nonnull));
568 fseg_header_t* seg_header,
579 fseg_header_t* seg_header,
582 __attribute__((nonnull, warn_unused_result));
593 fseg_header_t* header,
606 fseg_header_t* header,
652 fseg_header_t* header,
655 #ifdef UNIV_BTR_PRINT
662 fseg_header_t* header,
678 __attribute__((warn_unused_result,
const));