19 #ifndef __NDB_DISKPAGE_HPP
20 #define __NDB_DISKPAGE_HPP
22 #include <ndb_types.h>
26 STATIC_CONST( NDB_PAGE_SIZE = 32768 );
27 STATIC_CONST( NDB_PAGE_SIZE_WORDS = NDB_PAGE_SIZE >> 2);
46 PT_Tup_fixsize_page = 0x2,
47 PT_Tup_varsize_page = 0x3,
61 void init(File_type ft, Uint32 node_id, Uint32 version, Uint32 now);
62 int validate(File_type ft, Uint32 node_id, Uint32 version, Uint32 now);
65 STATIC_CONST( NDB_PAGE_HEADER_WORDS =
sizeof(
Page_header) >> 2);
74 Uint32 m_tablespace_id;
75 Uint32 m_tablespace_version;
77 Uint32 m_extent_pages;
79 Uint32 m_extent_count;
80 Uint32 m_extent_headers_per_page;
81 Uint32 m_extent_header_words;
82 Uint32 m_extent_header_bits_per_page;
91 Uint32 m_next_free_extent;
94 Uint32 m_page_bitmask[1];
95 Uint32 get_free_bits(Uint32
page)
const;
96 Uint32 get_free_word_offset(Uint32 page)
const;
97 void update_free_bits(Uint32 page, Uint32 bit);
98 bool check_free(Uint32 extent_size)
const ;
101 STATIC_CONST( EXTENT_HEADER_BITMASK_BITS_PER_PAGE = 4 );
102 STATIC_CONST( EXTENT_HEADER_FIXED_WORDS = (
sizeof(
Extent_header)>>2) - 1);
111 Extent_header* get_header(Uint32 extent_no, Uint32 extent_size);
114 STATIC_CONST( EXTENT_PAGE_WORDS = NDB_PAGE_SIZE_WORDS - NDB_PAGE_HEADER_WORDS );
128 Uint32 m_logfile_group_id;
129 Uint32 m_logfile_group_version;
163 ,UNDO_TUP_ALLOC_EXTENT = 8
164 ,UNDO_TUP_FREE_EXTENT = 9
167 ,UNDO_NEXT_LSN = 0x8000
173 Uint32 m_type_length;
176 STATIC_CONST( UNDO_PAGE_WORDS = NDB_PAGE_SIZE_WORDS - NDB_PAGE_HEADER_WORDS - 1);
186 return EXTENT_HEADER_FIXED_WORDS +
187 ((extent_size_in_pages * EXTENT_HEADER_BITMASK_BITS_PER_PAGE + 31) >> 5);
192 File_formats::Datafile::Extent_page::get_header(Uint32 no, Uint32 extent_size)
194 Uint32 * tmp = (Uint32*)m_extents;
196 return (Extent_header*)tmp;
201 File_formats::Datafile::Extent_header::get_free_bits(Uint32
page)
const
203 return ((m_page_bitmask[page >> 3] >> ((page & 7) << 2))) & 15;
208 File_formats::Datafile::Extent_header::get_free_word_offset(Uint32 page)
const
215 File_formats::Datafile::Extent_header::update_free_bits(Uint32 page,
218 Uint32 shift = (page & 7) << 2;
219 Uint32 mask = (15 << shift);
220 Uint32 org = m_page_bitmask[page >> 3];
221 m_page_bitmask[page >> 3] = (org & ~mask) | (bit << shift);
226 File_formats::Datafile::Extent_header::check_free(Uint32 extent_size)
const
228 Uint32 words = (extent_size * EXTENT_HEADER_BITMASK_BITS_PER_PAGE + 31) >> 5;
230 for(; words; words--)
231 sum |= m_page_bitmask[words-1];
239 #include <NdbOut.hpp>