diff options
-rw-r--r-- | extra/innochecksum.cc | 4 | ||||
-rw-r--r-- | storage/innobase/fsp/fsp0fsp.cc | 282 | ||||
-rw-r--r-- | storage/innobase/include/fsp0fsp.h | 26 | ||||
-rw-r--r-- | storage/innobase/include/fsp0fsp.ic | 48 | ||||
-rw-r--r-- | storage/innobase/row/row0import.cc | 2 |
5 files changed, 96 insertions, 266 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index f971fac20ec..3bc00b339b1 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -895,8 +895,8 @@ parse_page( const byte* des = xdes + XDES_ARR_OFFSET + XDES_SIZE * ((page_no & (physical_page_size - 1)) / FSP_EXTENT_SIZE); - if (xdes_get_bit(des, XDES_FREE_BIT, - page_no % FSP_EXTENT_SIZE)) { + if (xdes_is_free(des, + page_no % FSP_EXTENT_SIZE)) { index.free_pages++; return; } diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index a172807f1dc..16b29126682 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -160,25 +160,6 @@ inline fsp_header_t* fsp_get_space_header(const fil_space_t* space, mtr_t* mtr) } /**********************************************************************//** -Gets a descriptor bit of a page. -@return TRUE if free */ -UNIV_INLINE -ibool -xdes_mtr_get_bit( -/*=============*/ - const xdes_t* descr, /*!< in: descriptor */ - ulint bit, /*!< in: XDES_FREE_BIT or XDES_CLEAN_BIT */ - ulint offset, /*!< in: page offset within extent: - 0 ... FSP_EXTENT_SIZE - 1 */ - mtr_t* mtr) /*!< in: mini-transaction */ -{ - ut_ad(mtr->is_active()); - ut_ad(mtr_memo_contains_page(mtr, descr, MTR_MEMO_PAGE_SX_FIX)); - - return(xdes_get_bit(descr, bit, offset)); -} - -/**********************************************************************//** Sets a descriptor bit of a page. */ UNIV_INLINE void @@ -212,102 +193,46 @@ xdes_set_bit( MLOG_1BYTE, mtr); } -/**********************************************************************//** -Looks for a descriptor bit having the desired value. Starts from hint -and scans upward; at the end of the extent the search is wrapped to -the start of the extent. -@return bit index of the bit, ULINT_UNDEFINED if not found */ -UNIV_INLINE -ulint -xdes_find_bit( -/*==========*/ - xdes_t* descr, /*!< in: descriptor */ - ulint bit, /*!< in: XDES_FREE_BIT or XDES_CLEAN_BIT */ - ibool val, /*!< in: desired bit value */ - ulint hint, /*!< in: hint of which bit position would - be desirable */ - mtr_t* mtr) /*!< in/out: mini-transaction */ +/** +Find a free page. +@param descr extent descriptor +@param hint page offset to start searching from (towards larger pages) +@return free page offset +@retval ULINT_UNDEFINED if no page is free */ +inline ulint xdes_find_free(const xdes_t *descr, ulint hint= 0) { - ulint i; - - ut_ad(descr && mtr); - ut_ad(val <= TRUE); - ut_ad(hint < FSP_EXTENT_SIZE); - ut_ad(mtr_memo_contains_page(mtr, descr, MTR_MEMO_PAGE_SX_FIX)); - for (i = hint; i < FSP_EXTENT_SIZE; i++) { - if (val == xdes_mtr_get_bit(descr, bit, i, mtr)) { - - return(i); - } - } - - for (i = 0; i < hint; i++) { - if (val == xdes_mtr_get_bit(descr, bit, i, mtr)) { - - return(i); - } - } - - return(ULINT_UNDEFINED); + ut_ad(hint < FSP_EXTENT_SIZE); + for (ulint i= hint; i < FSP_EXTENT_SIZE; i++) + if (xdes_is_free(descr, i)) + return i; + for (ulint i= 0; i < hint; i++) + if (xdes_is_free(descr, i)) + return i; + return ULINT_UNDEFINED; } -/**********************************************************************//** -Returns the number of used pages in a descriptor. +/** +Determine the number of used pages in a descriptor. +@param descr file descriptor @return number of pages used */ -UNIV_INLINE -ulint -xdes_get_n_used( -/*============*/ - const xdes_t* descr, /*!< in: descriptor */ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - ulint count = 0; - - ut_ad(descr && mtr); - ut_ad(mtr_memo_contains_page(mtr, descr, MTR_MEMO_PAGE_SX_FIX)); - for (ulint i = 0; i < FSP_EXTENT_SIZE; ++i) { - if (FALSE == xdes_mtr_get_bit(descr, XDES_FREE_BIT, i, mtr)) { - count++; - } - } - - return(count); -} - -/**********************************************************************//** -Returns true if extent contains no used pages. -@return TRUE if totally free */ -UNIV_INLINE -ibool -xdes_is_free( -/*=========*/ - const xdes_t* descr, /*!< in: descriptor */ - mtr_t* mtr) /*!< in/out: mini-transaction */ +inline ulint xdes_get_n_used(const xdes_t *descr) { - if (0 == xdes_get_n_used(descr, mtr)) { + ulint count= 0; - return(TRUE); - } + for (ulint i= 0; i < FSP_EXTENT_SIZE; ++i) + if (!xdes_is_free(descr, i)) + count++; - return(FALSE); + return count; } -/**********************************************************************//** -Returns true if extent contains no free pages. -@return TRUE if full */ -UNIV_INLINE -ibool -xdes_is_full( -/*=========*/ - const xdes_t* descr, /*!< in: descriptor */ - mtr_t* mtr) /*!< in/out: mini-transaction */ +/** +Determine whether a file extent is full. +@param descr file descriptor +@return whether all pages have been allocated */ +inline bool xdes_is_full(const xdes_t *descr) { - if (FSP_EXTENT_SIZE == xdes_get_n_used(descr, mtr)) { - - return(TRUE); - } - - return(FALSE); + return FSP_EXTENT_SIZE == xdes_get_n_used(descr); } /**********************************************************************//** @@ -1114,7 +1039,7 @@ fsp_alloc_from_free_frag( ulint frag_n_used; ut_ad(xdes_get_state(descr, mtr) == XDES_FREE_FRAG); - ut_a(xdes_mtr_get_bit(descr, XDES_FREE_BIT, bit, mtr)); + ut_a(xdes_is_free(descr, bit)); xdes_set_bit(descr, XDES_FREE_BIT, bit, FALSE, mtr); /* Update the FRAG_N_USED field */ @@ -1122,7 +1047,7 @@ fsp_alloc_from_free_frag( frag_n_used++; mlog_write_ulint(header + FSP_FRAG_N_USED, frag_n_used, MLOG_4BYTES, mtr); - if (xdes_is_full(descr, mtr)) { + if (xdes_is_full(descr)) { /* The fragment is full: move it to another list */ flst_remove(header + FSP_FREE_FRAG, descr + XDES_FLST_NODE, mtr); @@ -1260,8 +1185,7 @@ fsp_alloc_free_page( /* Now we have in descr an extent with at least one free page. Look for a free page in the extent. */ - free = xdes_find_bit(descr, XDES_FREE_BIT, TRUE, - hint % FSP_EXTENT_SIZE, mtr); + free = xdes_find_free(descr, hint % FSP_EXTENT_SIZE); if (free == ULINT_UNDEFINED) { ut_print_buf(stderr, ((byte*) descr) - 500, 1000); @@ -1346,9 +1270,7 @@ static void fsp_free_page(fil_space_t* space, page_no_t offset, ut_error; } - if (xdes_mtr_get_bit(descr, XDES_FREE_BIT, - offset % FSP_EXTENT_SIZE, mtr)) { - + if (xdes_is_free(descr, offset % FSP_EXTENT_SIZE)) { ib::error() << "File space extent descriptor of page " << page_id_t(space->id, offset) << " says it is free."; @@ -1395,7 +1317,7 @@ static void fsp_free_page(fil_space_t* space, page_no_t offset, MLOG_4BYTES, mtr); } - if (xdes_is_free(descr, mtr)) { + if (!xdes_get_n_used(descr)) { /* The extent has become free: move it to another list */ flst_remove(header + FSP_FREE_FRAG, descr + XDES_FLST_NODE, mtr); @@ -1436,50 +1358,29 @@ inline ulint FSP_SEG_INODES_PER_PAGE(ulint physical_size) /** Returns the nth inode slot on an inode page. @param[in] page segment inode page @param[in] i inode index on page -@param[in] physical_size page size -@param[in,out] mtr mini-transaction @return segment inode */ -UNIV_INLINE -fseg_inode_t* -fsp_seg_inode_page_get_nth_inode( - page_t* page, - ulint i, - ulint physical_size, - mtr_t* mtr) -{ - ut_ad(i < FSP_SEG_INODES_PER_PAGE(physical_size)); - ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_SX_FIX)); - - return(page + FSEG_ARR_OFFSET + FSEG_INODE_SIZE * i); -} +#define fsp_seg_inode_page_get_nth_inode(page, i) \ + FSEG_ARR_OFFSET + FSEG_INODE_SIZE * i + page /** Looks for a used segment inode on a segment inode page. @param[in] page segment inode page @param[in] physical_size page size -@param[in,out] mtr mini-transaction @return segment inode index, or ULINT_UNDEFINED if not found */ static ulint -fsp_seg_inode_page_find_used( - page_t* page, - ulint physical_size, - mtr_t* mtr) +fsp_seg_inode_page_find_used(const page_t* page, ulint physical_size) { - ulint i; - fseg_inode_t* inode; - - for (i = 0; i < FSP_SEG_INODES_PER_PAGE(physical_size); i++) { - - inode = fsp_seg_inode_page_get_nth_inode( - page, i, physical_size, mtr); - - if (mach_read_from_8(inode + FSEG_ID)) { - /* This is used */ - - ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) - == FSEG_MAGIC_N_VALUE); - return(i); + for (ulint i = 0; i < FSP_SEG_INODES_PER_PAGE(physical_size); i++) { + if (!mach_read_from_8( + FSEG_ID + + fsp_seg_inode_page_get_nth_inode(page, i))) { + continue; } + /* This is used */ + ut_ad(FSEG_MAGIC_N_VALUE == mach_read_from_4( + FSEG_MAGIC_N + + fsp_seg_inode_page_get_nth_inode(page, i))); + return i; } return(ULINT_UNDEFINED); @@ -1489,33 +1390,25 @@ fsp_seg_inode_page_find_used( @param[in] page segment inode page @param[in] i search forward starting from this index @param[in] physical_size page size -@param[in,out] mtr mini-transaction @return segment inode index, or ULINT_UNDEFINED if not found */ static ulint -fsp_seg_inode_page_find_free( - page_t* page, - ulint i, - ulint physical_size, - mtr_t* mtr) +fsp_seg_inode_page_find_free(const page_t* page, ulint i, ulint physical_size) { for (; i < FSP_SEG_INODES_PER_PAGE(physical_size); i++) { - - fseg_inode_t* inode; - - inode = fsp_seg_inode_page_get_nth_inode( - page, i, physical_size, mtr); - - if (!mach_read_from_8(inode + FSEG_ID)) { + if (!mach_read_from_8( + FSEG_ID + + fsp_seg_inode_page_get_nth_inode(page, i))) { /* This is unused */ - return(i); + return i; } - ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) - == FSEG_MAGIC_N_VALUE); + ut_ad(FSEG_MAGIC_N_VALUE == mach_read_from_4( + FSEG_MAGIC_N + + fsp_seg_inode_page_get_nth_inode(page, i))); } - return(ULINT_UNDEFINED); + return ULINT_UNDEFINED; } /** Allocate a file segment inode page. @@ -1581,7 +1474,6 @@ fsp_alloc_seg_inode( buf_block_t* block; page_t* page; fseg_inode_t* inode; - ulint n; ut_ad(page_offset(space_header) == FSP_HEADER_OFFSET); @@ -1602,15 +1494,14 @@ fsp_alloc_seg_inode( const ulint physical_size = space->physical_size(); - n = fsp_seg_inode_page_find_free(page, 0, physical_size, mtr); + ulint n = fsp_seg_inode_page_find_free(page, 0, physical_size); - ut_a(n != ULINT_UNDEFINED); + ut_a(n < FSP_SEG_INODES_PER_PAGE(physical_size)); - inode = fsp_seg_inode_page_get_nth_inode(page, n, physical_size, mtr); + inode = fsp_seg_inode_page_get_nth_inode(page, n); if (ULINT_UNDEFINED == fsp_seg_inode_page_find_free(page, n + 1, - physical_size, - mtr)) { + physical_size)) { /* There are no other unused headers left on the page: move it to another list */ @@ -1649,7 +1540,7 @@ static void fsp_free_seg_inode( const ulint physical_size = space->physical_size(); if (ULINT_UNDEFINED - == fsp_seg_inode_page_find_free(page, 0, physical_size, mtr)) { + == fsp_seg_inode_page_find_free(page, 0, physical_size)) { /* Move the page to another list */ @@ -1664,7 +1555,7 @@ static void fsp_free_seg_inode( mlog_write_ulint(inode + FSEG_MAGIC_N, 0xfa051ce3, MLOG_4BYTES, mtr); if (ULINT_UNDEFINED - == fsp_seg_inode_page_find_used(page, physical_size, mtr)) { + == fsp_seg_inode_page_find_used(page, physical_size)) { /* There are no other used headers left on the page: free it */ @@ -2235,8 +2126,7 @@ fseg_alloc_free_page_low( /*-------------------------------------------------------------*/ if ((xdes_get_state(descr, mtr) == XDES_FSEG) && mach_read_from_8(descr + XDES_ID) == seg_id - && (xdes_mtr_get_bit(descr, XDES_FREE_BIT, - hint % FSP_EXTENT_SIZE, mtr) == TRUE)) { + && xdes_is_free(descr, hint % FSP_EXTENT_SIZE)) { take_hinted_page: /* 1. We can take the hinted page =================================*/ @@ -2290,7 +2180,7 @@ take_hinted_page: /*-----------------------------------------------------------*/ } else if ((xdes_get_state(descr, mtr) == XDES_FSEG) && mach_read_from_8(descr + XDES_ID) == seg_id - && (!xdes_is_full(descr, mtr))) { + && (!xdes_is_full(descr))) { /* 4. We can take the page from the same extent as the ====================================================== @@ -2300,8 +2190,7 @@ take_hinted_page: ========*/ ret_descr = descr; ret_page = xdes_get_offset(ret_descr) - + xdes_find_bit(ret_descr, XDES_FREE_BIT, TRUE, - hint % FSP_EXTENT_SIZE, mtr); + + xdes_find_free(ret_descr, hint % FSP_EXTENT_SIZE); ut_ad(!has_done_reservation || ret_page != FIL_NULL); /*-----------------------------------------------------------*/ } else if (reserved - used > 0) { @@ -2321,8 +2210,7 @@ take_hinted_page: ret_descr = xdes_lst_get_descriptor(space, first, mtr); ret_page = xdes_get_offset(ret_descr) - + xdes_find_bit(ret_descr, XDES_FREE_BIT, TRUE, - 0, mtr); + + xdes_find_free(ret_descr); ut_ad(!has_done_reservation || ret_page != FIL_NULL); /*-----------------------------------------------------------*/ } else if (used < FSEG_FRAG_LIMIT) { @@ -2400,10 +2288,7 @@ got_hinted_page: or FSEG_FREE), and the page is not yet marked as used. */ ut_ad(xdes_get_descriptor(space, ret_page, mtr) == ret_descr); - - ut_ad(xdes_mtr_get_bit( - ret_descr, XDES_FREE_BIT, - ret_page % FSP_EXTENT_SIZE, mtr)); + ut_ad(xdes_is_free(ret_descr, ret_page % FSP_EXTENT_SIZE)); fseg_mark_page_used(seg_inode, ret_page, ret_descr, mtr); } @@ -2509,7 +2394,7 @@ fsp_reserve_free_pages( descr = xdes_get_descriptor_with_space_hdr( space_header, space, 0, mtr); - n_used = xdes_get_n_used(descr, mtr); + n_used = xdes_get_n_used(descr); ut_a(n_used <= size); @@ -2679,7 +2564,7 @@ fseg_mark_page_used( == FSEG_MAGIC_N_VALUE); ut_ad(!memcmp(seg_inode + FSEG_ID, descr + XDES_ID, 4)); - if (xdes_is_free(descr, mtr)) { + if (!xdes_get_n_used(descr)) { /* We move the extent from the free list to the NOT_FULL list */ flst_remove(seg_inode + FSEG_FREE, descr + XDES_FLST_NODE, @@ -2688,8 +2573,7 @@ fseg_mark_page_used( descr + XDES_FLST_NODE, mtr); } - ut_ad(xdes_mtr_get_bit( - descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)); + ut_ad(xdes_is_free(descr, page % FSP_EXTENT_SIZE)); /* We mark the page as used */ xdes_set_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, FALSE, mtr); @@ -2698,7 +2582,7 @@ fseg_mark_page_used( not_full_n_used++; mlog_write_ulint(seg_inode + FSEG_NOT_FULL_N_USED, not_full_n_used, MLOG_4BYTES, mtr); - if (xdes_is_full(descr, mtr)) { + if (xdes_is_full(descr)) { /* We move the extent from the NOT_FULL list to the FULL list */ flst_remove(seg_inode + FSEG_NOT_FULL, @@ -2756,8 +2640,7 @@ fseg_free_page_low( descr = xdes_get_descriptor(space, offset, mtr); - if (xdes_mtr_get_bit(descr, XDES_FREE_BIT, - offset % FSP_EXTENT_SIZE, mtr)) { + if (xdes_is_free(descr, offset % FSP_EXTENT_SIZE)) { ib::fatal() << "InnoDB is trying to free page " << page_id_t(space->id, offset) << " though it is already marked as free in the" @@ -2807,7 +2690,7 @@ fseg_free_page_low( } not_full_n_used = mach_read_from_4(seg_inode + FSEG_NOT_FULL_N_USED); - if (xdes_is_full(descr, mtr)) { + if (xdes_is_full(descr)) { /* The fragment is full: move it to another list */ flst_remove(seg_inode + FSEG_FULL, descr + XDES_FLST_NODE, mtr); @@ -2827,7 +2710,7 @@ fseg_free_page_low( xdes_set_bit(descr, XDES_FREE_BIT, bit, TRUE, mtr); xdes_set_bit(descr, XDES_CLEAN_BIT, bit, TRUE, mtr); - if (xdes_is_free(descr, mtr)) { + if (!xdes_get_n_used(descr)) { /* The extent has become free: free it to space */ flst_remove(seg_inode + FSEG_NOT_FULL, descr + XDES_FLST_NODE, mtr); @@ -2898,8 +2781,7 @@ fseg_page_is_free(fil_space_t* space, unsigned page) is_free = true; } else if (const xdes_t* descr = xdes_get_descriptor_const( space, dpage, page, &mtr)) { - is_free = xdes_get_bit(descr, XDES_FREE_BIT, - page % FSP_EXTENT_SIZE); + is_free = xdes_is_free(descr, page % FSP_EXTENT_SIZE); } else { is_free = true; } @@ -2947,8 +2829,7 @@ fseg_free_extent( #ifdef BTR_CUR_HASH_ADAPT if (ahi) { for (ulint i = 0; i < FSP_EXTENT_SIZE; i++) { - if (!xdes_mtr_get_bit(descr, XDES_FREE_BIT, i, mtr)) { - + if (!xdes_is_free(descr, i)) { /* Drop search system page hash index if the page is found in the pool and is hashed */ @@ -2961,10 +2842,10 @@ fseg_free_extent( } #endif /* BTR_CUR_HASH_ADAPT */ - if (xdes_is_full(descr, mtr)) { + if (xdes_is_full(descr)) { flst_remove(seg_inode + FSEG_FULL, descr + XDES_FLST_NODE, mtr); - } else if (xdes_is_free(descr, mtr)) { + } else if (!xdes_get_n_used(descr)) { flst_remove(seg_inode + FSEG_FREE, descr + XDES_FLST_NODE, mtr); } else { @@ -2973,7 +2854,7 @@ fseg_free_extent( not_full_n_used = mach_read_from_4(FSEG_NOT_FULL_N_USED + seg_inode); - descr_n_used = xdes_get_n_used(descr, mtr); + descr_n_used = xdes_get_n_used(descr); ut_a(not_full_n_used >= descr_n_used); mlog_write_ulint(seg_inode + FSEG_NOT_FULL_N_USED, not_full_n_used - descr_n_used, @@ -3033,8 +2914,7 @@ fseg_free_step_func( /* Check that the header resides on a page which has not been freed yet */ - ut_a(xdes_mtr_get_bit(descr, XDES_FREE_BIT, - header_page % FSP_EXTENT_SIZE, mtr) == FALSE); + ut_a(!xdes_is_free(descr, header_page % FSP_EXTENT_SIZE)); buf_block_t* iblock; const ulint zip_size = space->zip_size(); inode = fseg_inode_try_get(header, space_id, zip_size, mtr, &iblock); diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index 26da55bb2ad..a87f1fb2fe6 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -288,6 +288,18 @@ the extent are free and which contain old tuple version to clean. */ /** Offset of the descriptor array on a descriptor page */ #define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE) +/** +Determine if a page is marked free. +@param[in] descr extent descriptor +@param[in] offset page offset within extent +@return whether the page is free */ +inline bool xdes_is_free(const xdes_t *descr, ulint offset) +{ + ut_ad(offset < FSP_EXTENT_SIZE); + ulint index= XDES_FREE_BIT + XDES_BITS_PER_PAGE * offset; + return ut_bit_get_nth(descr[XDES_BITMAP + (index >> 3)], index & 7); +} + #ifndef UNIV_INNOCHECKSUM /* @} */ @@ -782,18 +794,6 @@ fsp_flags_match(ulint expected, ulint actual) return(actual == expected); } -/**********************************************************************//** -Gets a descriptor bit of a page. -@return TRUE if free */ -UNIV_INLINE -ibool -xdes_get_bit( -/*=========*/ - const xdes_t* descr, /*!< in: descriptor */ - ulint bit, /*!< in: XDES_FREE_BIT or XDES_CLEAN_BIT */ - ulint offset);/*!< in: page offset within extent: - 0 ... FSP_EXTENT_SIZE - 1 */ - /** Determine the descriptor index within a descriptor page. @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] offset page offset @@ -833,6 +833,4 @@ inline ulint xdes_calc_descriptor_page(ulint zip_size, ulint offset) #endif /* UNIV_INNOCHECKSUM */ -#include "fsp0fsp.ic" - #endif diff --git a/storage/innobase/include/fsp0fsp.ic b/storage/innobase/include/fsp0fsp.ic deleted file mode 100644 index 31b9d8c5dbe..00000000000 --- a/storage/innobase/include/fsp0fsp.ic +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2019, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/fsp0fsp.ic -File space management - -Created 12/18/1995 Heikki Tuuri -*******************************************************/ - -/**********************************************************************//** -Gets a descriptor bit of a page. -@return TRUE if free */ -UNIV_INLINE -ibool -xdes_get_bit( -/*=========*/ - const xdes_t* descr, /*!< in: descriptor */ - ulint bit, /*!< in: XDES_FREE_BIT or XDES_CLEAN_BIT */ - ulint offset) /*!< in: page offset within extent: - 0 ... FSP_EXTENT_SIZE - 1 */ -{ - ut_ad(offset < FSP_EXTENT_SIZE); - ut_ad(bit == XDES_FREE_BIT || bit == XDES_CLEAN_BIT); - - ulint index = bit + XDES_BITS_PER_PAGE * offset; - - ulint bit_index = index % 8; - ulint byte_index = index / 8; - - return ut_bit_get_nth(descr[XDES_BITMAP + byte_index], bit_index); -} diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 212cea838d7..4323cf973eb 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -502,7 +502,7 @@ protected: const xdes_t* xdesc = xdes(page_no, m_xdes); ulint pos = page_no % FSP_EXTENT_SIZE; - return(xdes_get_bit(xdesc, XDES_FREE_BIT, pos)); + return xdes_is_free(xdesc, pos); } /* If the current xdes was free, the page must be free. */ |