Commit 736a8ffb authored by marko's avatar marko

branches/zip: Replace buf_frame_get_page_no() and buf_frame_get_space_id()

with page_get_page_no() and page_get_space_id().  We want to avoid
buf_block_align() calls, and the page_no and space_id are now stamped
on the pages early on.
parent 1003d199
This diff is collapsed.
...@@ -204,7 +204,7 @@ btr_cur_latch_leaves( ...@@ -204,7 +204,7 @@ btr_cur_latch_leaves(
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(get_page, mtr) ut_a(btr_page_get_next(get_page, mtr)
== buf_frame_get_page_no(page)); == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(get_page) == page_is_comp(page)); ut_a(page_is_comp(get_page) == page_is_comp(page));
buf_block_align(get_page)->check_index_page_at_flush buf_block_align(get_page)->check_index_page_at_flush
...@@ -222,7 +222,7 @@ btr_cur_latch_leaves( ...@@ -222,7 +222,7 @@ btr_cur_latch_leaves(
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(get_page, mtr) ut_a(btr_page_get_prev(get_page, mtr)
== buf_frame_get_page_no(page)); == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
buf_block_align(get_page)->check_index_page_at_flush buf_block_align(get_page)->check_index_page_at_flush
= TRUE; = TRUE;
...@@ -238,7 +238,7 @@ btr_cur_latch_leaves( ...@@ -238,7 +238,7 @@ btr_cur_latch_leaves(
RW_S_LATCH, mtr); RW_S_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(cursor->left_page, mtr) ut_a(btr_page_get_next(cursor->left_page, mtr)
== buf_frame_get_page_no(page)); == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(cursor->left_page) ut_a(page_is_comp(cursor->left_page)
== page_is_comp(page)); == page_is_comp(page));
...@@ -260,7 +260,7 @@ btr_cur_latch_leaves( ...@@ -260,7 +260,7 @@ btr_cur_latch_leaves(
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(cursor->left_page, mtr) ut_a(btr_page_get_next(cursor->left_page, mtr)
== buf_frame_get_page_no(page)); == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(cursor->left_page) ut_a(page_is_comp(cursor->left_page)
== page_is_comp(page)); == page_is_comp(page));
...@@ -1200,7 +1200,7 @@ btr_cur_optimistic_insert( ...@@ -1200,7 +1200,7 @@ btr_cur_optimistic_insert(
#if 0 #if 0
fprintf(stderr, "Insert into page %lu, max ins size %lu," fprintf(stderr, "Insert into page %lu, max ins size %lu,"
" rec %lu ind type %lu\n", " rec %lu ind type %lu\n",
buf_frame_get_page_no(page), max_size, page_get_page_no(page), max_size,
rec_size + PAGE_DIR_SLOT_SIZE, type); rec_size + PAGE_DIR_SLOT_SIZE, type);
#endif #endif
if (!(type & DICT_CLUSTERED)) { if (!(type & DICT_CLUSTERED)) {
...@@ -1373,7 +1373,7 @@ btr_cur_pessimistic_insert( ...@@ -1373,7 +1373,7 @@ btr_cur_pessimistic_insert(
} }
} }
if (dict_index_get_page(index) == buf_frame_get_page_no(page)) { if (dict_index_get_page(index) == page_get_page_no(page)) {
/* The page is the root page */ /* The page is the root page */
*rec = btr_root_raise_and_insert(cursor, entry, *rec = btr_root_raise_and_insert(cursor, entry,
...@@ -1943,14 +1943,14 @@ btr_cur_pess_upd_restore_supremum( ...@@ -1943,14 +1943,14 @@ btr_cur_pess_upd_restore_supremum(
return; return;
} }
space = buf_frame_get_space_id(page); space = page_get_space_id(page);
prev_page_no = btr_page_get_prev(page, mtr); prev_page_no = btr_page_get_prev(page, mtr);
ut_ad(prev_page_no != FIL_NULL); ut_ad(prev_page_no != FIL_NULL);
prev_page = buf_page_get_with_no_latch(space, prev_page_no, mtr); prev_page = buf_page_get_with_no_latch(space, prev_page_no, mtr);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr) ut_a(btr_page_get_next(prev_page, mtr)
== buf_frame_get_page_no(page)); == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
/* We must already have an x-latch to prev_page! */ /* We must already have an x-latch to prev_page! */
...@@ -2776,7 +2776,7 @@ btr_cur_pessimistic_delete( ...@@ -2776,7 +2776,7 @@ btr_cur_pessimistic_delete(
if (UNIV_UNLIKELY(page_get_n_recs(page) < 2) if (UNIV_UNLIKELY(page_get_n_recs(page) < 2)
&& UNIV_UNLIKELY(dict_index_get_page(btr_cur_get_index(cursor)) && UNIV_UNLIKELY(dict_index_get_page(btr_cur_get_index(cursor))
!= buf_frame_get_page_no(page))) { != page_get_page_no(page))) {
/* If there is only one record, drop the whole page in /* If there is only one record, drop the whole page in
btr_discard_page, if this is not the root page */ btr_discard_page, if this is not the root page */
...@@ -2819,7 +2819,7 @@ btr_cur_pessimistic_delete( ...@@ -2819,7 +2819,7 @@ btr_cur_pessimistic_delete(
btr_node_ptr_delete(index, page, mtr); btr_node_ptr_delete(index, page, mtr);
node_ptr = dict_index_build_node_ptr( node_ptr = dict_index_build_node_ptr(
index, next_rec, buf_frame_get_page_no(page), index, next_rec, page_get_page_no(page),
heap, level); heap, level);
btr_insert_on_non_leaf_level(index, btr_insert_on_non_leaf_level(index,
...@@ -3605,7 +3605,7 @@ btr_store_big_rec_extern_fields( ...@@ -3605,7 +3605,7 @@ btr_store_big_rec_extern_fields(
ut_ad(mtr_memo_contains_page(local_mtr, rec, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains_page(local_mtr, rec, MTR_MEMO_PAGE_X_FIX));
ut_a(dict_index_is_clust(index)); ut_a(dict_index_is_clust(index));
space_id = buf_frame_get_space_id(rec); space_id = page_get_space_id(page_align(rec));
page_zip = buf_frame_get_page_zip(rec); page_zip = buf_frame_get_page_zip(rec);
ut_a(dict_table_zip_size(index->table) ut_a(dict_table_zip_size(index->table)
...@@ -3655,7 +3655,8 @@ btr_store_big_rec_extern_fields( ...@@ -3655,7 +3655,8 @@ btr_store_big_rec_extern_fields(
mtr_start(&mtr); mtr_start(&mtr);
if (prev_page_no == FIL_NULL) { if (prev_page_no == FIL_NULL) {
hint_page_no = buf_frame_get_page_no(rec) + 1; hint_page_no = 1
+ page_get_page_no(page_align(rec));
} else { } else {
hint_page_no = prev_page_no + 1; hint_page_no = prev_page_no + 1;
} }
...@@ -3673,7 +3674,7 @@ btr_store_big_rec_extern_fields( ...@@ -3673,7 +3674,7 @@ btr_store_big_rec_extern_fields(
return(DB_OUT_OF_FILE_SPACE); return(DB_OUT_OF_FILE_SPACE);
} }
page_no = buf_frame_get_page_no(page); page_no = page_get_page_no(page);
if (prev_page_no != FIL_NULL) { if (prev_page_no != FIL_NULL) {
page_t* prev_page; page_t* prev_page;
...@@ -3748,10 +3749,10 @@ btr_store_big_rec_extern_fields( ...@@ -3748,10 +3749,10 @@ btr_store_big_rec_extern_fields(
goto next_zip_page; goto next_zip_page;
} }
rec_page = buf_page_get(space_id, rec_page = buf_page_get(
buf_frame_get_page_no( space_id, page_get_page_no(
field_ref), page_align(field_ref)),
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(rec_page, buf_page_dbg_add_level(rec_page,
SYNC_NO_ORDER_CHECK); SYNC_NO_ORDER_CHECK);
...@@ -3825,10 +3826,10 @@ btr_store_big_rec_extern_fields( ...@@ -3825,10 +3826,10 @@ btr_store_big_rec_extern_fields(
extern_len -= store_len; extern_len -= store_len;
rec_page = buf_page_get(space_id, rec_page = buf_page_get(
buf_frame_get_page_no( space_id, page_get_page_no(
field_ref), page_align(field_ref)),
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(rec_page, buf_page_dbg_add_level(rec_page,
SYNC_NO_ORDER_CHECK); SYNC_NO_ORDER_CHECK);
...@@ -3937,8 +3938,10 @@ btr_free_externally_stored_field( ...@@ -3937,8 +3938,10 @@ btr_free_externally_stored_field(
for (;;) { for (;;) {
mtr_start(&mtr); mtr_start(&mtr);
rec_page = buf_page_get(buf_frame_get_space_id(field_ref), rec_page = buf_page_get(page_get_space_id(
buf_frame_get_page_no(field_ref), page_align(field_ref)),
page_get_page_no(
page_align(field_ref)),
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK); buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK);
...@@ -4008,8 +4011,8 @@ btr_free_externally_stored_field( ...@@ -4008,8 +4011,8 @@ btr_free_externally_stored_field(
because we did not store it on the page (we save the because we did not store it on the page (we save the
space overhead from an index page header. */ space overhead from an index page header. */
ut_a(space_id == buf_frame_get_space_id(page)); ut_a(space_id == page_get_space_id(page));
ut_a(page_no == buf_frame_get_page_no(page)); ut_a(page_no == page_get_page_no(page));
btr_page_free_low(index, page, btr_page_free_low(index, page,
space_id, page_no, 0, &mtr); space_id, page_no, 0, &mtr);
......
...@@ -391,13 +391,13 @@ btr_pcur_move_to_next_page( ...@@ -391,13 +391,13 @@ btr_pcur_move_to_next_page(
page = btr_pcur_get_page(cursor); page = btr_pcur_get_page(cursor);
next_page_no = btr_page_get_next(page, mtr); next_page_no = btr_page_get_next(page, mtr);
space = buf_frame_get_space_id(page); space = page_get_space_id(page);
ut_ad(next_page_no != FIL_NULL); ut_ad(next_page_no != FIL_NULL);
next_page = btr_page_get(space, next_page_no, cursor->latch_mode, mtr); next_page = btr_page_get(space, next_page_no, cursor->latch_mode, mtr);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(next_page, mtr) == buf_frame_get_page_no(page)); ut_a(btr_page_get_prev(next_page, mtr) == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(next_page) == page_is_comp(page)); ut_a(page_is_comp(next_page) == page_is_comp(page));
buf_block_align(next_page)->check_index_page_at_flush = TRUE; buf_block_align(next_page)->check_index_page_at_flush = TRUE;
...@@ -463,7 +463,7 @@ btr_pcur_move_backward_from_page( ...@@ -463,7 +463,7 @@ btr_pcur_move_backward_from_page(
page = btr_pcur_get_page(cursor); page = btr_pcur_get_page(cursor);
prev_page_no = btr_page_get_prev(page, mtr); prev_page_no = btr_page_get_prev(page, mtr);
space = buf_frame_get_space_id(page); space = page_get_space_id(page);
if (btr_pcur_is_before_first_on_page(cursor, mtr) if (btr_pcur_is_before_first_on_page(cursor, mtr)
&& (prev_page_no != FIL_NULL)) { && (prev_page_no != FIL_NULL)) {
......
...@@ -1654,7 +1654,7 @@ btr_search_validate(void) ...@@ -1654,7 +1654,7 @@ btr_search_validate(void)
"InnoDB: ptr mem address %p" "InnoDB: ptr mem address %p"
" index id %lu %lu," " index id %lu %lu,"
" node fold %lu, rec fold %lu\n", " node fold %lu, rec fold %lu\n",
(ulong) buf_frame_get_page_no(page), (ulong) page_get_page_no(page),
node->data, node->data,
(ulong) ut_dulint_get_high( (ulong) ut_dulint_get_high(
btr_page_get_index_id(page)), btr_page_get_index_id(page)),
......
...@@ -1477,8 +1477,8 @@ buf_page_optimistic_get_func( ...@@ -1477,8 +1477,8 @@ buf_page_optimistic_get_func(
/* In the case of a first access, try to apply linear /* In the case of a first access, try to apply linear
read-ahead */ read-ahead */
buf_read_ahead_linear(buf_frame_get_space_id(guess), buf_read_ahead_linear(page_get_space_id(guess),
buf_frame_get_page_no(guess)); page_get_page_no(guess));
} }
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
......
...@@ -123,7 +123,7 @@ dict_hdr_create( ...@@ -123,7 +123,7 @@ dict_hdr_create(
page = fseg_create(DICT_HDR_SPACE, 0, page = fseg_create(DICT_HDR_SPACE, 0,
DICT_HDR + DICT_HDR_FSEG_HEADER, mtr); DICT_HDR + DICT_HDR_FSEG_HEADER, mtr);
hdr_page_no = buf_frame_get_page_no(page); hdr_page_no = page_get_page_no(page);
ut_a(DICT_HDR_PAGE_NO == hdr_page_no); ut_a(DICT_HDR_PAGE_NO == hdr_page_no);
......
...@@ -783,7 +783,7 @@ xdes_lst_get_next( ...@@ -783,7 +783,7 @@ xdes_lst_get_next(
ut_ad(mtr && descr); ut_ad(mtr && descr);
space = buf_frame_get_space_id(descr); space = page_get_space_id(page_align(descr));
return(xdes_lst_get_descriptor( return(xdes_lst_get_descriptor(
space, space,
...@@ -801,7 +801,7 @@ xdes_get_offset( ...@@ -801,7 +801,7 @@ xdes_get_offset(
{ {
ut_ad(descr); ut_ad(descr);
return(buf_frame_get_page_no(descr) return(page_get_page_no(page_align(descr))
+ ((page_offset(descr) - XDES_ARR_OFFSET) / XDES_SIZE) + ((page_offset(descr) - XDES_ARR_OFFSET) / XDES_SIZE)
* FSP_EXTENT_SIZE); * FSP_EXTENT_SIZE);
} }
...@@ -1827,7 +1827,7 @@ fsp_alloc_seg_inode_page( ...@@ -1827,7 +1827,7 @@ fsp_alloc_seg_inode_page(
ulint zip_size; ulint zip_size;
ulint i; ulint i;
space = buf_frame_get_space_id(space_header); space = page_get_space_id(page_align(space_header));
page_no = fsp_alloc_free_page(space, 0, mtr); page_no = fsp_alloc_free_page(space, 0, mtr);
...@@ -1894,8 +1894,8 @@ fsp_alloc_seg_inode( ...@@ -1894,8 +1894,8 @@ fsp_alloc_seg_inode(
page_no = flst_get_first(space_header + FSP_SEG_INODES_FREE, mtr).page; page_no = flst_get_first(space_header + FSP_SEG_INODES_FREE, mtr).page;
zip_size = mach_read_from_4(space_header + FSP_PAGE_ZIP_SIZE); zip_size = mach_read_from_4(space_header + FSP_PAGE_ZIP_SIZE);
page = buf_page_get(buf_frame_get_space_id(space_header), page_no, page = buf_page_get(page_get_space_id(page_align(space_header)),
RW_X_LATCH, mtr); page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_FSP_PAGE); buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -1965,7 +1965,7 @@ fsp_free_seg_inode( ...@@ -1965,7 +1965,7 @@ fsp_free_seg_inode(
flst_remove(space_header + FSP_SEG_INODES_FREE, flst_remove(space_header + FSP_SEG_INODES_FREE,
page + FSEG_INODE_PAGE_NODE, mtr); page + FSEG_INODE_PAGE_NODE, mtr);
fsp_free_page(space, buf_frame_get_page_no(page), mtr); fsp_free_page(space, page_get_page_no(page), mtr);
} }
} }
...@@ -2228,7 +2228,8 @@ fseg_create_general( ...@@ -2228,7 +2228,8 @@ fseg_create_general(
page_offset(inode), MLOG_2BYTES, mtr); page_offset(inode), MLOG_2BYTES, mtr);
mlog_write_ulint(header + FSEG_HDR_PAGE_NO, mlog_write_ulint(header + FSEG_HDR_PAGE_NO,
buf_frame_get_page_no(inode), MLOG_4BYTES, mtr); page_get_page_no(page_align(inode)),
MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSEG_HDR_SPACE, space, MLOG_4BYTES, mtr); mlog_write_ulint(header + FSEG_HDR_SPACE, space, MLOG_4BYTES, mtr);
...@@ -2309,7 +2310,7 @@ fseg_n_reserved_pages( ...@@ -2309,7 +2310,7 @@ fseg_n_reserved_pages(
fseg_inode_t* inode; fseg_inode_t* inode;
ulint space; ulint space;
space = buf_frame_get_space_id(header); space = page_get_space_id(page_align(header));
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex) ut_ad(!mutex_own(&kernel_mutex)
...@@ -2710,7 +2711,7 @@ fseg_alloc_free_page_general( ...@@ -2710,7 +2711,7 @@ fseg_alloc_free_page_general(
ulint page_no; ulint page_no;
ulint n_reserved; ulint n_reserved;
space = buf_frame_get_space_id(seg_header); space = page_get_space_id(page_align(seg_header));
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex) ut_ad(!mutex_own(&kernel_mutex)
...@@ -2740,7 +2741,8 @@ fseg_alloc_free_page_general( ...@@ -2740,7 +2741,8 @@ fseg_alloc_free_page_general(
} }
} }
page_no = fseg_alloc_free_page_low(buf_frame_get_space_id(inode), page_no = fseg_alloc_free_page_low(page_get_space_id(
page_align(inode)),
inode, hint, direction, mtr); inode, hint, direction, mtr);
if (!has_done_reservation) { if (!has_done_reservation) {
fil_space_release_free_extents(space, n_reserved); fil_space_release_free_extents(space, n_reserved);
...@@ -3353,8 +3355,10 @@ fseg_free_step( ...@@ -3353,8 +3355,10 @@ fseg_free_step(
xdes_t* descr; xdes_t* descr;
fseg_inode_t* inode; fseg_inode_t* inode;
ulint space; ulint space;
ulint header_page;
space = buf_frame_get_space_id(header); space = page_get_space_id(page_align(header));
header_page = page_get_page_no(page_align(header));
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex) ut_ad(!mutex_own(&kernel_mutex)
...@@ -3363,14 +3367,14 @@ fseg_free_step( ...@@ -3363,14 +3367,14 @@ fseg_free_step(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(fil_space_get_latch(space), mtr); mtr_x_lock(fil_space_get_latch(space), mtr);
descr = xdes_get_descriptor(space, buf_frame_get_page_no(header), mtr); descr = xdes_get_descriptor(space, header_page, mtr);
/* Check that the header resides on a page which has not been /* Check that the header resides on a page which has not been
freed yet */ freed yet */
ut_a(descr); ut_a(descr);
ut_a(xdes_get_bit(descr, XDES_FREE_BIT, buf_frame_get_page_no(header) ut_a(xdes_get_bit(descr, XDES_FREE_BIT,
% FSP_EXTENT_SIZE, mtr) == FALSE); header_page % FSP_EXTENT_SIZE, mtr) == FALSE);
inode = fseg_inode_get(header, mtr); inode = fseg_inode_get(header, mtr);
descr = fseg_get_first_extent(inode, mtr); descr = fseg_get_first_extent(inode, mtr);
...@@ -3429,7 +3433,7 @@ fseg_free_step_not_header( ...@@ -3429,7 +3433,7 @@ fseg_free_step_not_header(
ulint space; ulint space;
ulint page_no; ulint page_no;
space = buf_frame_get_space_id(header); space = page_get_space_id(page_align(header));
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex) ut_ad(!mutex_own(&kernel_mutex)
...@@ -3461,7 +3465,7 @@ fseg_free_step_not_header( ...@@ -3461,7 +3465,7 @@ fseg_free_step_not_header(
page_no = fseg_get_nth_frag_page_no(inode, n, mtr); page_no = fseg_get_nth_frag_page_no(inode, n, mtr);
if (page_no == buf_frame_get_page_no(header)) { if (page_no == page_get_page_no(page_align(header))) {
return(TRUE); return(TRUE);
} }
...@@ -3527,7 +3531,7 @@ fseg_get_first_extent( ...@@ -3527,7 +3531,7 @@ fseg_get_first_extent(
ut_ad(inode && mtr); ut_ad(inode && mtr);
space = buf_frame_get_space_id(inode); space = page_get_space_id(page_align(inode));
first = fil_addr_null; first = fil_addr_null;
...@@ -3574,7 +3578,7 @@ fseg_validate_low( ...@@ -3574,7 +3578,7 @@ fseg_validate_low(
ut_ad(mtr_memo_contains_page(mtr2, inode, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains_page(mtr2, inode, MTR_MEMO_PAGE_X_FIX));
ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
space = buf_frame_get_space_id(inode); space = page_get_space_id(page_align(inode));
seg_id = mtr_read_dulint(inode + FSEG_ID, mtr2); seg_id = mtr_read_dulint(inode + FSEG_ID, mtr2);
n_used = mtr_read_ulint(inode + FSEG_NOT_FULL_N_USED, n_used = mtr_read_ulint(inode + FSEG_NOT_FULL_N_USED,
...@@ -3661,7 +3665,7 @@ fseg_validate( ...@@ -3661,7 +3665,7 @@ fseg_validate(
ibool ret; ibool ret;
ulint space; ulint space;
space = buf_frame_get_space_id(header); space = page_get_space_id(page_align(header));
mtr_x_lock(fil_space_get_latch(space), mtr2); mtr_x_lock(fil_space_get_latch(space), mtr2);
...@@ -3695,8 +3699,8 @@ fseg_print_low( ...@@ -3695,8 +3699,8 @@ fseg_print_low(
dulint d_var; dulint d_var;
ut_ad(mtr_memo_contains_page(mtr, inode, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains_page(mtr, inode, MTR_MEMO_PAGE_X_FIX));
space = buf_frame_get_space_id(inode); space = page_get_space_id(page_align(inode));
page_no = buf_frame_get_page_no(inode); page_no = page_get_page_no(page_align(inode));
reserved = fseg_n_reserved_pages_low(inode, &used, mtr); reserved = fseg_n_reserved_pages_low(inode, &used, mtr);
...@@ -3736,7 +3740,7 @@ fseg_print( ...@@ -3736,7 +3740,7 @@ fseg_print(
fseg_inode_t* inode; fseg_inode_t* inode;
ulint space; ulint space;
space = buf_frame_get_space_id(header); space = page_get_space_id(page_align(header));
mtr_x_lock(fil_space_get_latch(space), mtr); mtr_x_lock(fil_space_get_latch(space), mtr);
......
...@@ -491,7 +491,7 @@ flst_print( ...@@ -491,7 +491,7 @@ flst_print(
fprintf(stderr, fprintf(stderr,
"FILE-BASED LIST:\n" "FILE-BASED LIST:\n"
"Base node in space %lu page %lu byte offset %lu; len %lu\n", "Base node in space %lu page %lu byte offset %lu; len %lu\n",
(ulong) buf_frame_get_space_id(frame), (ulong) page_get_space_id(frame),
(ulong) buf_frame_get_page_no(frame), (ulong) page_get_page_no(frame),
(ulong) (base - frame), (ulong) len); (ulong) (base - frame), (ulong) len);
} }
...@@ -688,7 +688,7 @@ ibuf_bitmap_page_set_bits( ...@@ -688,7 +688,7 @@ ibuf_bitmap_page_set_bits(
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
ut_a((bit != IBUF_BITMAP_BUFFERED) || (val != FALSE) ut_a((bit != IBUF_BITMAP_BUFFERED) || (val != FALSE)
|| (0 == ibuf_count_get(buf_frame_get_space_id(page), || (0 == ibuf_count_get(page_get_space_id(page),
page_no))); page_no)));
#endif #endif
if (!zip_size) { if (!zip_size) {
...@@ -802,15 +802,15 @@ ibuf_set_free_bits_low( ...@@ -802,15 +802,15 @@ ibuf_set_free_bits_low(
return; return;
} }
space = buf_frame_get_space_id(page); space = page_get_space_id(page);
page_no = buf_frame_get_page_no(page); page_no = page_get_page_no(page);
zip_size = fil_space_get_zip_size(space); zip_size = fil_space_get_zip_size(space);
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, mtr); bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, mtr);
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
# if 0 # if 0
fprintf(stderr, fprintf(stderr,
"Setting page no %lu free bits to %lu should be %lu\n", "Setting page no %lu free bits to %lu should be %lu\n",
buf_frame_get_page_no(page), val, page_get_page_no(page), val,
ibuf_index_page_calc_free(page)); ibuf_index_page_calc_free(page));
# endif # endif
...@@ -855,8 +855,8 @@ ibuf_set_free_bits( ...@@ -855,8 +855,8 @@ ibuf_set_free_bits(
mtr_start(&mtr); mtr_start(&mtr);
space = buf_frame_get_space_id(page); space = page_get_space_id(page);
page_no = buf_frame_get_page_no(page); page_no = page_get_page_no(page);
zip_size = fil_space_get_zip_size(space); zip_size = fil_space_get_zip_size(space);
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, &mtr); bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, &mtr);
...@@ -871,7 +871,7 @@ ibuf_set_free_bits( ...@@ -871,7 +871,7 @@ ibuf_set_free_bits(
if (old_val != max_val) { if (old_val != max_val) {
fprintf(stderr, fprintf(stderr,
"Ibuf: page %lu old val %lu max val %lu\n", "Ibuf: page %lu old val %lu max val %lu\n",
buf_frame_get_page_no(page), page_get_page_no(page),
old_val, max_val); old_val, max_val);
} }
# endif # endif
...@@ -882,7 +882,7 @@ ibuf_set_free_bits( ...@@ -882,7 +882,7 @@ ibuf_set_free_bits(
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
# if 0 # if 0
fprintf(stderr, "Setting page no %lu free bits to %lu should be %lu\n", fprintf(stderr, "Setting page no %lu free bits to %lu should be %lu\n",
buf_frame_get_page_no(page), val, page_get_page_no(page), val,
ibuf_index_page_calc_free(page)); ibuf_index_page_calc_free(page));
# endif # endif
...@@ -2399,7 +2399,7 @@ ibuf_get_volume_buffered( ...@@ -2399,7 +2399,7 @@ ibuf_get_volume_buffered(
prev_page = buf_page_get(0, prev_page_no, RW_X_LATCH, mtr); prev_page = buf_page_get(0, prev_page_no, RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr) ut_a(btr_page_get_next(prev_page, mtr)
== buf_frame_get_page_no(page)); == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -2466,7 +2466,7 @@ ibuf_get_volume_buffered( ...@@ -2466,7 +2466,7 @@ ibuf_get_volume_buffered(
next_page = buf_page_get(0, next_page_no, RW_X_LATCH, mtr); next_page = buf_page_get(0, next_page_no, RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(next_page, mtr) ut_a(btr_page_get_prev(next_page, mtr)
== buf_frame_get_page_no(page)); == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -2967,9 +2967,9 @@ ibuf_insert_to_index_page( ...@@ -2967,9 +2967,9 @@ ibuf_insert_to_index_page(
" Please run CHECK TABLE on\n" " Please run CHECK TABLE on\n"
"InnoDB: that table.\n", stderr); "InnoDB: that table.\n", stderr);
space = buf_frame_get_space_id(page); space = page_get_space_id(page);
zip_size = fil_space_get_zip_size(space); zip_size = fil_space_get_zip_size(space);
page_no = buf_frame_get_page_no(page); page_no = page_get_page_no(page);
bitmap_page = ibuf_bitmap_get_map_page( bitmap_page = ibuf_bitmap_get_map_page(
space, page_no, zip_size, mtr); space, page_no, zip_size, mtr);
......
...@@ -110,7 +110,7 @@ btr_cur_compress_recommendation( ...@@ -110,7 +110,7 @@ btr_cur_compress_recommendation(
root page. */ root page. */
return(dict_index_get_page(cursor->index) return(dict_index_get_page(cursor->index)
!= buf_frame_get_page_no(page)); != page_get_page_no(page));
} }
return(FALSE); return(FALSE);
...@@ -147,7 +147,7 @@ btr_cur_can_delete_without_compress( ...@@ -147,7 +147,7 @@ btr_cur_can_delete_without_compress(
compression if this is not the root page. */ compression if this is not the root page. */
return(dict_index_get_page(cursor->index) return(dict_index_get_page(cursor->index)
== buf_frame_get_page_no(page)); == page_get_page_no(page));
} }
return(TRUE); return(TRUE);
......
...@@ -446,24 +446,6 @@ buf_page_is_corrupted( ...@@ -446,24 +446,6 @@ buf_page_is_corrupted(
ulint zip_size); /* in: size of compressed page; ulint zip_size); /* in: size of compressed page;
0 for uncompressed pages */ 0 for uncompressed pages */
/************************************************************************** /**************************************************************************
Gets the page number of a pointer pointing within a buffer frame containing
a file page. */
UNIV_INLINE
ulint
buf_frame_get_page_no(
/*==================*/
/* out: page number */
byte* ptr); /* in: pointer to within a buffer frame */
/**************************************************************************
Gets the space id of a pointer pointing within a buffer frame containing a
file page. */
UNIV_INLINE
ulint
buf_frame_get_space_id(
/*===================*/
/* out: space id */
byte* ptr); /* in: pointer to within a buffer frame */
/**************************************************************************
Gets the space id, page offset, and byte offset within page of a Gets the space id, page offset, and byte offset within page of a
pointer pointing to a buffer frame containing a file page. */ pointer pointing to a buffer frame containing a file page. */
UNIV_INLINE UNIV_INLINE
......
...@@ -251,32 +251,6 @@ buf_block_align( ...@@ -251,32 +251,6 @@ buf_block_align(
return(block); return(block);
} }
/**************************************************************************
Gets the page number of a pointer pointing within a buffer frame containing
a file page. */
UNIV_INLINE
ulint
buf_frame_get_page_no(
/*==================*/
/* out: page number */
byte* ptr) /* in: pointer to within a buffer frame */
{
return(buf_block_get_page_no(buf_block_align(ptr)));
}
/**************************************************************************
Gets the space id of a pointer pointing within a buffer frame containing a
file page. */
UNIV_INLINE
ulint
buf_frame_get_space_id(
/*===================*/
/* out: space id */
byte* ptr) /* in: pointer to within a buffer frame */
{
return(buf_block_get_space(buf_block_align(ptr)));
}
/************************************************************************** /**************************************************************************
Gets the space id, page offset, and byte offset within page of a Gets the space id, page offset, and byte offset within page of a
pointer pointing to a buffer frame containing a file page. */ pointer pointing to a buffer frame containing a file page. */
......
...@@ -156,7 +156,7 @@ UNIV_INLINE ...@@ -156,7 +156,7 @@ UNIV_INLINE
dulint dulint
page_get_max_trx_id( page_get_max_trx_id(
/*================*/ /*================*/
page_t* page); /* in: page */ const page_t* page); /* in: page */
/***************************************************************** /*****************************************************************
Sets the max trx id field value. */ Sets the max trx id field value. */
...@@ -184,8 +184,8 @@ UNIV_INLINE ...@@ -184,8 +184,8 @@ UNIV_INLINE
ulint ulint
page_header_get_field( page_header_get_field(
/*==================*/ /*==================*/
page_t* page, /* in: page */ const page_t* page, /* in: page */
ulint field); /* in: PAGE_N_DIR_SLOTS, ... */ ulint field); /* in: PAGE_N_DIR_SLOTS, ... */
/***************************************************************** /*****************************************************************
Sets the given header field. */ Sets the given header field. */
UNIV_INLINE UNIV_INLINE
...@@ -280,14 +280,30 @@ page_cmp_dtuple_rec_with_match( ...@@ -280,14 +280,30 @@ page_cmp_dtuple_rec_with_match(
matched; when function returns contains the matched; when function returns contains the
value for current comparison */ value for current comparison */
/***************************************************************** /*****************************************************************
Gets the page number. */
UNIV_INLINE
ulint
page_get_page_no(
/*=============*/
/* out: page number */
const page_t* page); /* in: page */
/*****************************************************************
Gets the tablespace identifier. */
UNIV_INLINE
ulint
page_get_space_id(
/*==============*/
/* out: space id */
const page_t* page); /* in: page */
/*****************************************************************
Gets the number of user records on page (the infimum and supremum records Gets the number of user records on page (the infimum and supremum records
are not user records). */ are not user records). */
UNIV_INLINE UNIV_INLINE
ulint ulint
page_get_n_recs( page_get_n_recs(
/*============*/ /*============*/
/* out: number of user records */ /* out: number of user records */
page_t* page); /* in: index page */ const page_t* page); /* in: index page */
/******************************************************************* /*******************************************************************
Returns the number of records before the given record in chain. Returns the number of records before the given record in chain.
The number includes infimum and supremum records. */ The number includes infimum and supremum records. */
...@@ -303,8 +319,8 @@ UNIV_INLINE ...@@ -303,8 +319,8 @@ UNIV_INLINE
ulint ulint
page_dir_get_n_heap( page_dir_get_n_heap(
/*================*/ /*================*/
/* out: number of user records */ /* out: number of user records */
page_t* page); /* in: index page */ const page_t* page); /* in: index page */
/***************************************************************** /*****************************************************************
Sets the number of records in the heap. */ Sets the number of records in the heap. */
UNIV_INLINE UNIV_INLINE
...@@ -324,8 +340,8 @@ UNIV_INLINE ...@@ -324,8 +340,8 @@ UNIV_INLINE
ulint ulint
page_dir_get_n_slots( page_dir_get_n_slots(
/*=================*/ /*=================*/
/* out: number of slots */ /* out: number of slots */
page_t* page); /* in: index page */ const page_t* page); /* in: index page */
/***************************************************************** /*****************************************************************
Sets the number of dir slots in directory. */ Sets the number of dir slots in directory. */
UNIV_INLINE UNIV_INLINE
...@@ -410,9 +426,9 @@ UNIV_INLINE ...@@ -410,9 +426,9 @@ UNIV_INLINE
ulint ulint
page_is_comp( page_is_comp(
/*=========*/ /*=========*/
/* out: nonzero if the page is in compact /* out: nonzero if the page is in compact
format, zero if it is in old-style format */ format, zero if it is in old-style format */
page_t* page); /* in: index page */ const page_t* page); /* in: index page */
/**************************************************************** /****************************************************************
TRUE if the record is on a page in compact format. */ TRUE if the record is on a page in compact format. */
UNIV_INLINE UNIV_INLINE
...@@ -549,9 +565,10 @@ UNIV_INLINE ...@@ -549,9 +565,10 @@ UNIV_INLINE
ulint ulint
page_get_max_insert_size( page_get_max_insert_size(
/*=====================*/ /*=====================*/
/* out: maximum combined size for inserted records */ /* out: maximum combined size for
page_t* page, /* in: index page */ inserted records */
ulint n_recs); /* in: number of records */ const page_t* page, /* in: index page */
ulint n_recs);/* in: number of records */
/**************************************************************** /****************************************************************
Returns the maximum combined size of records which can be inserted on top Returns the maximum combined size of records which can be inserted on top
of record heap if page is first reorganized. */ of record heap if page is first reorganized. */
...@@ -559,9 +576,10 @@ UNIV_INLINE ...@@ -559,9 +576,10 @@ UNIV_INLINE
ulint ulint
page_get_max_insert_size_after_reorganize( page_get_max_insert_size_after_reorganize(
/*======================================*/ /*======================================*/
/* out: maximum combined size for inserted records */ /* out: maximum combined size for
page_t* page, /* in: index page */ inserted records */
ulint n_recs);/* in: number of records */ const page_t* page, /* in: index page */
ulint n_recs);/* in: number of records */
/***************************************************************** /*****************************************************************
Calculates free space if a page is emptied. */ Calculates free space if a page is emptied. */
UNIV_INLINE UNIV_INLINE
...@@ -588,8 +606,8 @@ UNIV_INLINE ...@@ -588,8 +606,8 @@ UNIV_INLINE
ulint ulint
page_get_data_size( page_get_data_size(
/*===============*/ /*===============*/
/* out: data in bytes */ /* out: data in bytes */
page_t* page); /* in: index page */ const page_t* page); /* in: index page */
/**************************************************************** /****************************************************************
Allocates a block of memory from the head of the free list Allocates a block of memory from the head of the free list
of an index page. */ of an index page. */
......
...@@ -44,7 +44,7 @@ UNIV_INLINE ...@@ -44,7 +44,7 @@ UNIV_INLINE
dulint dulint
page_get_max_trx_id( page_get_max_trx_id(
/*================*/ /*================*/
page_t* page) /* in: page */ const page_t* page) /* in: page */
{ {
ut_ad(page); ut_ad(page);
...@@ -77,8 +77,8 @@ UNIV_INLINE ...@@ -77,8 +77,8 @@ UNIV_INLINE
ulint ulint
page_header_get_field( page_header_get_field(
/*==================*/ /*==================*/
page_t* page, /* in: page */ const page_t* page, /* in: page */
ulint field) /* in: PAGE_LEVEL, ... */ ulint field) /* in: PAGE_LEVEL, ... */
{ {
ut_ad(page); ut_ad(page);
ut_ad(field <= PAGE_INDEX_ID); ut_ad(field <= PAGE_INDEX_ID);
...@@ -200,9 +200,9 @@ UNIV_INLINE ...@@ -200,9 +200,9 @@ UNIV_INLINE
ulint ulint
page_is_comp( page_is_comp(
/*=========*/ /*=========*/
/* out: nonzero if the page is in compact /* out: nonzero if the page is in compact
format, zero if it is in old-style format */ format, zero if it is in old-style format */
page_t* page) /* in: index page */ const page_t* page) /* in: index page */
{ {
return(UNIV_EXPECT(page_header_get_field(page, PAGE_N_HEAP) & 0x8000, return(UNIV_EXPECT(page_header_get_field(page, PAGE_N_HEAP) & 0x8000,
0x8000)); 0x8000));
...@@ -421,6 +421,32 @@ page_cmp_dtuple_rec_with_match( ...@@ -421,6 +421,32 @@ page_cmp_dtuple_rec_with_match(
matched_bytes)); matched_bytes));
} }
/*****************************************************************
Gets the page number. */
UNIV_INLINE
ulint
page_get_page_no(
/*=============*/
/* out: page number */
const page_t* page) /* in: page */
{
ut_ad(page == page_align((page_t*) page));
return(mach_read_from_4(page + FIL_PAGE_OFFSET));
}
/*****************************************************************
Gets the tablespace identifier. */
UNIV_INLINE
ulint
page_get_space_id(
/*==============*/
/* out: space id */
const page_t* page) /* in: page */
{
ut_ad(page == page_align((page_t*) page));
return(mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
}
/***************************************************************** /*****************************************************************
Gets the number of user records on page (infimum and supremum records Gets the number of user records on page (infimum and supremum records
are not user records). */ are not user records). */
...@@ -428,8 +454,8 @@ UNIV_INLINE ...@@ -428,8 +454,8 @@ UNIV_INLINE
ulint ulint
page_get_n_recs( page_get_n_recs(
/*============*/ /*============*/
/* out: number of user records */ /* out: number of user records */
page_t* page) /* in: index page */ const page_t* page) /* in: index page */
{ {
return(page_header_get_field(page, PAGE_N_RECS)); return(page_header_get_field(page, PAGE_N_RECS));
} }
...@@ -440,8 +466,8 @@ UNIV_INLINE ...@@ -440,8 +466,8 @@ UNIV_INLINE
ulint ulint
page_dir_get_n_slots( page_dir_get_n_slots(
/*=================*/ /*=================*/
/* out: number of slots */ /* out: number of slots */
page_t* page) /* in: index page */ const page_t* page) /* in: index page */
{ {
return(page_header_get_field(page, PAGE_N_DIR_SLOTS)); return(page_header_get_field(page, PAGE_N_DIR_SLOTS));
} }
...@@ -465,8 +491,8 @@ UNIV_INLINE ...@@ -465,8 +491,8 @@ UNIV_INLINE
ulint ulint
page_dir_get_n_heap( page_dir_get_n_heap(
/*================*/ /*================*/
/* out: number of user records */ /* out: number of user records */
page_t* page) /* in: index page */ const page_t* page) /* in: index page */
{ {
return(page_header_get_field(page, PAGE_N_HEAP) & 0x7fff); return(page_header_get_field(page, PAGE_N_HEAP) & 0x7fff);
} }
...@@ -788,8 +814,8 @@ UNIV_INLINE ...@@ -788,8 +814,8 @@ UNIV_INLINE
ulint ulint
page_get_data_size( page_get_data_size(
/*===============*/ /*===============*/
/* out: data in bytes */ /* out: data in bytes */
page_t* page) /* in: index page */ const page_t* page) /* in: index page */
{ {
ulint ret; ulint ret;
...@@ -868,9 +894,10 @@ UNIV_INLINE ...@@ -868,9 +894,10 @@ UNIV_INLINE
ulint ulint
page_get_max_insert_size( page_get_max_insert_size(
/*=====================*/ /*=====================*/
/* out: maximum combined size for inserted records */ /* out: maximum combined size for
page_t* page, /* in: index page */ inserted records */
ulint n_recs) /* in: number of records */ const page_t* page, /* in: index page */
ulint n_recs) /* in: number of records */
{ {
ulint occupied; ulint occupied;
ulint free_space; ulint free_space;
...@@ -910,9 +937,10 @@ UNIV_INLINE ...@@ -910,9 +937,10 @@ UNIV_INLINE
ulint ulint
page_get_max_insert_size_after_reorganize( page_get_max_insert_size_after_reorganize(
/*======================================*/ /*======================================*/
/* out: maximum combined size for inserted records */ /* out: maximum combined size for
page_t* page, /* in: index page */ inserted records */
ulint n_recs) /* in: number of records */ const page_t* page, /* in: index page */
ulint n_recs) /* in: number of records */
{ {
ulint occupied; ulint occupied;
ulint free_space; ulint free_space;
......
...@@ -7,6 +7,7 @@ Created 3/26/1996 Heikki Tuuri ...@@ -7,6 +7,7 @@ Created 3/26/1996 Heikki Tuuri
*******************************************************/ *******************************************************/
#include "data0type.h" #include "data0type.h"
#include "page0page.h"
/*************************************************************************** /***************************************************************************
Builds a roll pointer dulint. */ Builds a roll pointer dulint. */
...@@ -177,7 +178,7 @@ trx_undo_page_get_start( ...@@ -177,7 +178,7 @@ trx_undo_page_get_start(
{ {
ulint start; ulint start;
if (page_no == buf_frame_get_page_no(undo_page)) { if (page_no == page_get_page_no(undo_page)) {
start = mach_read_from_2(offset + undo_page start = mach_read_from_2(offset + undo_page
+ TRX_UNDO_LOG_START); + TRX_UNDO_LOG_START);
...@@ -203,7 +204,7 @@ trx_undo_page_get_end( ...@@ -203,7 +204,7 @@ trx_undo_page_get_end(
trx_ulogf_t* log_hdr; trx_ulogf_t* log_hdr;
ulint end; ulint end;
if (page_no == buf_frame_get_page_no(undo_page)) { if (page_no == page_get_page_no(undo_page)) {
log_hdr = undo_page + offset; log_hdr = undo_page + offset;
......
...@@ -1258,8 +1258,8 @@ lock_rec_get_first_on_page( ...@@ -1258,8 +1258,8 @@ lock_rec_get_first_on_page(
{ {
ulint hash; ulint hash;
lock_t* lock; lock_t* lock;
ulint space; ulint space = page_get_space_id(page_align(ptr));
ulint page_no; ulint page_no = page_get_page_no(page_align(ptr));
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
...@@ -1270,9 +1270,6 @@ lock_rec_get_first_on_page( ...@@ -1270,9 +1270,6 @@ lock_rec_get_first_on_page(
lock = HASH_GET_FIRST(lock_sys->rec_hash, hash); lock = HASH_GET_FIRST(lock_sys->rec_hash, hash);
while (lock) { while (lock) {
space = buf_frame_get_space_id(ptr);
page_no = buf_frame_get_page_no(ptr);
if ((lock->un_member.rec_lock.space == space) if ((lock->un_member.rec_lock.space == space)
&& (lock->un_member.rec_lock.page_no == page_no)) { && (lock->un_member.rec_lock.page_no == page_no)) {
...@@ -1768,8 +1765,8 @@ lock_rec_create( ...@@ -1768,8 +1765,8 @@ lock_rec_create(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
page = page_align(rec); page = page_align(rec);
space = buf_frame_get_space_id(page); space = page_get_space_id(page);
page_no = buf_frame_get_page_no(page); page_no = page_get_page_no(page);
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table)); ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
...@@ -2433,8 +2430,8 @@ lock_rec_free_all_from_discard_page( ...@@ -2433,8 +2430,8 @@ lock_rec_free_all_from_discard_page(
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
space = buf_frame_get_space_id(page); space = page_get_space_id(page);
page_no = buf_frame_get_page_no(page); page_no = page_get_page_no(page);
lock = lock_rec_get_first_on_page_addr(space, page_no); lock = lock_rec_get_first_on_page_addr(space, page_no);
...@@ -2764,8 +2761,8 @@ lock_move_reorganize_page( ...@@ -2764,8 +2761,8 @@ lock_move_reorganize_page(
mem_heap_free(heap); mem_heap_free(heap);
#if 0 #if 0
ut_ad(lock_rec_validate_page(buf_frame_get_space_id(page), ut_ad(lock_rec_validate_page(page_get_space_id(page),
buf_frame_get_page_no(page))); page_get_page_no(page)));
#endif #endif
} }
...@@ -2860,10 +2857,10 @@ lock_move_rec_list_end( ...@@ -2860,10 +2857,10 @@ lock_move_rec_list_end(
lock_mutex_exit_kernel(); lock_mutex_exit_kernel();
#if 0 #if 0
ut_ad(lock_rec_validate_page(buf_frame_get_space_id(page), ut_ad(lock_rec_validate_page(page_get_space_id(page),
buf_frame_get_page_no(page))); page_get_page_no(page)));
ut_ad(lock_rec_validate_page(buf_frame_get_space_id(new_page), ut_ad(lock_rec_validate_page(page_get_space_id(new_page),
buf_frame_get_page_no(new_page))); page_get_page_no(new_page)));
#endif #endif
} }
...@@ -2952,10 +2949,10 @@ lock_move_rec_list_start( ...@@ -2952,10 +2949,10 @@ lock_move_rec_list_start(
lock_mutex_exit_kernel(); lock_mutex_exit_kernel();
#if 0 #if 0
ut_ad(lock_rec_validate_page(buf_frame_get_space_id(page), ut_ad(lock_rec_validate_page(page_get_space_id(page),
buf_frame_get_page_no(page))); page_get_page_no(page)));
ut_ad(lock_rec_validate_page(buf_frame_get_space_id(new_page), ut_ad(lock_rec_validate_page(page_get_space_id(new_page),
buf_frame_get_page_no(new_page))); page_get_page_no(new_page)));
#endif #endif
} }
......
...@@ -108,7 +108,7 @@ page_dir_find_owner_slot( ...@@ -108,7 +108,7 @@ page_dir_find_owner_slot(
"InnoDB: Probable data corruption on" "InnoDB: Probable data corruption on"
" page %lu\n" " page %lu\n"
"InnoDB: Original record ", "InnoDB: Original record ",
(ulong) buf_frame_get_page_no(page)); (ulong) page_get_page_no(page));
if (page_is_comp(page)) { if (page_is_comp(page)) {
fputs("(compact record)", stderr); fputs("(compact record)", stderr);
...@@ -2298,7 +2298,7 @@ page_validate( ...@@ -2298,7 +2298,7 @@ page_validate(
fprintf(stderr, fprintf(stderr,
"InnoDB: Records in wrong order" "InnoDB: Records in wrong order"
" on page %lu ", " on page %lu ",
(ulong) buf_frame_get_page_no(page)); (ulong) page_get_page_no(page));
dict_index_name_print(stderr, NULL, index); dict_index_name_print(stderr, NULL, index);
fputs("\nInnoDB: previous record ", stderr); fputs("\nInnoDB: previous record ", stderr);
rec_print_new(stderr, old_rec, old_offsets); rec_print_new(stderr, old_rec, old_offsets);
...@@ -2452,7 +2452,7 @@ page_validate( ...@@ -2452,7 +2452,7 @@ page_validate(
if (UNIV_UNLIKELY(ret == FALSE)) { if (UNIV_UNLIKELY(ret == FALSE)) {
func_exit2: func_exit2:
fprintf(stderr, "InnoDB: Apparent corruption in page %lu in ", fprintf(stderr, "InnoDB: Apparent corruption in page %lu in ",
(ulong) buf_frame_get_page_no(page)); (ulong) page_get_page_no(page));
dict_index_name_print(stderr, NULL, index); dict_index_name_print(stderr, NULL, index);
putc('\n', stderr); putc('\n', stderr);
buf_page_print(page, 0); buf_page_print(page, 0);
......
...@@ -3709,7 +3709,7 @@ row_search_for_mysql( ...@@ -3709,7 +3709,7 @@ row_search_for_mysql(
fputs("Using ", stderr); fputs("Using ", stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, index);
fprintf(stderr, " cnt %lu ; Page no %lu\n", cnt, fprintf(stderr, " cnt %lu ; Page no %lu\n", cnt,
buf_frame_get_page_no(page_align(rec))); page_get_page_no(page_align(rec)));
rec_print(rec); rec_print(rec);
*/ */
#endif /* UNIV_SEARCH_DEBUG */ #endif /* UNIV_SEARCH_DEBUG */
...@@ -3792,7 +3792,7 @@ row_search_for_mysql( ...@@ -3792,7 +3792,7 @@ row_search_for_mysql(
"InnoDB: ", "InnoDB: ",
(ulong) page_offset(rec), (ulong) page_offset(rec),
(ulong) next_offs, (ulong) next_offs,
(ulong) buf_frame_get_page_no(rec)); (ulong) page_get_page_no(page_align(rec)));
dict_index_name_print(stderr, trx, index); dict_index_name_print(stderr, trx, index);
fputs(". Run CHECK TABLE. You may need to\n" fputs(". Run CHECK TABLE. You may need to\n"
"InnoDB: restore from a backup, or" "InnoDB: restore from a backup, or"
...@@ -3812,7 +3812,7 @@ row_search_for_mysql( ...@@ -3812,7 +3812,7 @@ row_search_for_mysql(
"InnoDB: ", "InnoDB: ",
(ulong) page_offset(rec), (ulong) page_offset(rec),
(ulong) next_offs, (ulong) next_offs,
(ulong) buf_frame_get_page_no(rec)); (ulong) page_get_page_no(page_align(rec)));
dict_index_name_print(stderr, trx, index); dict_index_name_print(stderr, trx, index);
fputs(". We try to skip the rest of the page.\n", fputs(". We try to skip the rest of the page.\n",
stderr); stderr);
...@@ -3837,7 +3837,7 @@ row_search_for_mysql( ...@@ -3837,7 +3837,7 @@ row_search_for_mysql(
"InnoDB: ", "InnoDB: ",
(ulong) page_offset(rec), (ulong) page_offset(rec),
(ulong) next_offs, (ulong) next_offs,
(ulong) buf_frame_get_page_no(rec)); (ulong) page_get_page_no(page_align(rec)));
dict_index_name_print(stderr, trx, index); dict_index_name_print(stderr, trx, index);
fputs(". We try to skip the record.\n", fputs(". We try to skip the record.\n",
stderr); stderr);
......
...@@ -788,7 +788,7 @@ trx_purge_choose_next_log(void) ...@@ -788,7 +788,7 @@ trx_purge_choose_next_log(void)
} else { } else {
purge_sys->purge_undo_no = trx_undo_rec_get_undo_no(rec); purge_sys->purge_undo_no = trx_undo_rec_get_undo_no(rec);
purge_sys->page_no = buf_frame_get_page_no(rec); purge_sys->page_no = page_get_page_no(page_align(rec));
purge_sys->offset = page_offset(rec); purge_sys->offset = page_offset(rec);
} }
...@@ -900,7 +900,7 @@ trx_purge_get_next_rec( ...@@ -900,7 +900,7 @@ trx_purge_get_next_rec(
page = page_align(rec2); page = page_align(rec2);
purge_sys->purge_undo_no = trx_undo_rec_get_undo_no(rec2); purge_sys->purge_undo_no = trx_undo_rec_get_undo_no(rec2);
purge_sys->page_no = buf_frame_get_page_no(page); purge_sys->page_no = page_get_page_no(page);
purge_sys->offset = rec2 - page; purge_sys->offset = rec2 - page;
if (undo_page != page) { if (undo_page != page) {
......
...@@ -839,7 +839,7 @@ trx_roll_pop_top_rec( ...@@ -839,7 +839,7 @@ trx_roll_pop_top_rec(
trx->pages_undone++; trx->pages_undone++;
} }
undo->top_page_no = buf_frame_get_page_no(prev_rec_page); undo->top_page_no = page_get_page_no(prev_rec_page);
undo->top_offset = prev_rec - prev_rec_page; undo->top_offset = prev_rec - prev_rec_page;
undo->top_undo_no = trx_undo_rec_get_undo_no(prev_rec); undo->top_undo_no = trx_undo_rec_get_undo_no(prev_rec);
} }
......
...@@ -87,7 +87,7 @@ trx_rseg_header_create( ...@@ -87,7 +87,7 @@ trx_rseg_header_create(
buf_page_dbg_add_level(page, SYNC_RSEG_HEADER_NEW); buf_page_dbg_add_level(page, SYNC_RSEG_HEADER_NEW);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
page_no = buf_frame_get_page_no(page); page_no = page_get_page_no(page);
/* Get the rollback segment file page */ /* Get the rollback segment file page */
rsegf = trx_rsegf_get_new(space, page_no, mtr); rsegf = trx_rsegf_get_new(space, page_no, mtr);
......
...@@ -851,7 +851,7 @@ trx_sysf_create( ...@@ -851,7 +851,7 @@ trx_sysf_create(
/* Create the trx sys file block in a new allocated file segment */ /* Create the trx sys file block in a new allocated file segment */
page = fseg_create(TRX_SYS_SPACE, 0, TRX_SYS + TRX_SYS_FSEG_HEADER, page = fseg_create(TRX_SYS_SPACE, 0, TRX_SYS + TRX_SYS_FSEG_HEADER,
mtr); mtr);
ut_a(buf_frame_get_page_no(page) == TRX_SYS_PAGE_NO); ut_a(page_get_page_no(page) == TRX_SYS_PAGE_NO);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TRX_SYS_HEADER); buf_page_dbg_add_level(page, SYNC_TRX_SYS_HEADER);
......
...@@ -154,7 +154,7 @@ trx_undo_get_prev_rec_from_prev_page( ...@@ -154,7 +154,7 @@ trx_undo_get_prev_rec_from_prev_page(
} }
prev_page = trx_undo_page_get_s_latched( prev_page = trx_undo_page_get_s_latched(
buf_frame_get_space_id(undo_page), prev_page_no, mtr); page_get_space_id(undo_page), prev_page_no, mtr);
return(trx_undo_page_get_last_rec(prev_page, page_no, offset)); return(trx_undo_page_get_last_rec(prev_page, page_no, offset));
} }
...@@ -208,7 +208,7 @@ trx_undo_get_next_rec_from_next_page( ...@@ -208,7 +208,7 @@ trx_undo_get_next_rec_from_next_page(
ulint space; ulint space;
ulint next; ulint next;
if (page_no == buf_frame_get_page_no(undo_page)) { if (page_no == page_get_page_no(undo_page)) {
log_hdr = undo_page + offset; log_hdr = undo_page + offset;
next = mach_read_from_2(log_hdr + TRX_UNDO_NEXT_LOG); next = mach_read_from_2(log_hdr + TRX_UNDO_NEXT_LOG);
...@@ -219,7 +219,7 @@ trx_undo_get_next_rec_from_next_page( ...@@ -219,7 +219,7 @@ trx_undo_get_next_rec_from_next_page(
} }
} }
space = buf_frame_get_space_id(undo_page); space = page_get_space_id(undo_page);
next_page_no = flst_get_next_addr(undo_page + TRX_UNDO_PAGE_HDR next_page_no = flst_get_next_addr(undo_page + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_NODE, mtr) + TRX_UNDO_PAGE_NODE, mtr)
...@@ -415,7 +415,7 @@ trx_undo_seg_create( ...@@ -415,7 +415,7 @@ trx_undo_seg_create(
return(NULL); return(NULL);
} }
space = buf_frame_get_space_id(rseg_hdr); space = page_get_space_id(page_align(rseg_hdr));
success = fsp_reserve_free_extents(&n_reserved, space, 2, FSP_UNDO, success = fsp_reserve_free_extents(&n_reserved, space, 2, FSP_UNDO,
mtr); mtr);
...@@ -458,7 +458,7 @@ trx_undo_seg_create( ...@@ -458,7 +458,7 @@ trx_undo_seg_create(
page_hdr + TRX_UNDO_PAGE_NODE, mtr); page_hdr + TRX_UNDO_PAGE_NODE, mtr);
trx_rsegf_set_nth_undo(rseg_hdr, slot_no, trx_rsegf_set_nth_undo(rseg_hdr, slot_no,
buf_frame_get_page_no(undo_page), mtr); page_get_page_no(undo_page), mtr);
*id = slot_no; *id = slot_no;
return(undo_page); return(undo_page);
...@@ -1128,7 +1128,7 @@ trx_undo_truncate_start( ...@@ -1128,7 +1128,7 @@ trx_undo_truncate_start(
return; return;
} }
page_no = buf_frame_get_page_no(undo_page); page_no = page_get_page_no(undo_page);
if (page_no == hdr_page_no) { if (page_no == hdr_page_no) {
trx_undo_empty_header_page(space, hdr_page_no, hdr_offset, trx_undo_empty_header_page(space, hdr_page_no, hdr_offset,
...@@ -1524,7 +1524,7 @@ trx_undo_create( ...@@ -1524,7 +1524,7 @@ trx_undo_create(
return(NULL); return(NULL);
} }
page_no = buf_frame_get_page_no(undo_page); page_no = page_get_page_no(undo_page);
offset = trx_undo_header_create(undo_page, trx_id, mtr); offset = trx_undo_header_create(undo_page, trx_id, mtr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment