Commit 5ed54e78 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove redundant XDES_FREE_BIT parameters

The page allocation bitmaps in the extent descriptor pages
contain two bits per page: XDES_FREE_BIT and XDES_CLEAN_BIT,
which is unused. Simplify read access.

xdes_is_free(descr,mtr): Remove. Use !xdes_get_n_used(descr) instead.

xdes_is_free(): Replaces xdes_get_bit(), xdes_mtr_get_bit().

xdes_find_free(): Replaces xdes_find_bit().

fsp_seg_inode_page_get_nth_inode(): Remove the redundant parameters
physical_size, mtr.

fsp_seg_inode_page_find_used(), fsp_seg_inode_page_find_free():
Remove the redundant parameter mtr.
parent 74b7d018
......@@ -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;
}
......
This diff is collapsed.
......@@ -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
/*****************************************************************************
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);
}
......@@ -502,7 +502,7 @@ class AbstractCallback
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. */
......
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