18 #include "Undo_buffer.hpp"
22 #if ZPAGE_STATE_POS != 0
30 Uint32 m_data[GLOBAL_PAGE_SIZE_WORDS-2];
32 STATIC_CONST( DATA_WORDS = GLOBAL_PAGE_SIZE_WORDS-2 );
35 #if defined VM_TRACE || defined ERROR_INSERT
44 return ((
UndoPage*)mm->get_memroot()) + no;
51 assert(
sizeof(
UndoPage) == 4*GLOBAL_PAGE_SIZE_WORDS);
62 if (m_first_free == RNIL)
64 page= (
UndoPage*)m_mm->alloc_page(RG_DATAMEM,
66 Ndbd_mem_manager::NDB_ZONE_ANY);
69 page->m_words_used= 0;
73 page = get_page(m_mm, m_first_free);
74 Uint32 pos= page->m_words_used;
76 if (words + pos > UndoPage::DATA_WORDS)
82 dst->m_page_no = m_first_free;
83 dst->m_page_idx = pos;
86 page->m_words_used = pos + words;
88 page->m_data[pos] = words;
89 page->m_data[pos + words - 1] = m_first_free + pos;
92 return page->m_data + pos;
98 assert(key->m_page_no == m_first_free);
100 assert(page->m_words_used >= words);
101 page->m_words_used -= words;
108 Uint32 cnt= page->m_ref_count;
111 page->m_ref_count= cnt - 1;
115 page->m_words_used= 0;
116 if (m_first_free == key->m_page_no)
123 m_mm->release_page(RG_DATAMEM, key->m_page_no);
133 Uint32 * ptr = page->m_data + key->m_page_idx;
135 Uint32 words = * ptr;
136 Uint32 check = ptr[words - 1];
137 if (unlikely(! ((check == key->m_page_no + key->m_page_idx))))