Commit 64488a6f authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove global functions or redundant parameters

fil_flush_file_spaces(): Remove the constant parameter.

buf_flush_start(), buf_flush_end(): Use static linkage.

fil_page_get_prev(), fil_page_get_next(), fil_addr_is_null(): Remove.
parent 97261cbb
......@@ -3308,28 +3308,22 @@ btr_cur_ins_lock_and_undo(
/**
Prefetch siblings of the leaf for the pessimistic operation.
@param block leaf page */
static
void
btr_cur_prefetch_siblings(
buf_block_t* block)
static void btr_cur_prefetch_siblings(const buf_block_t* block)
{
page_t* page = buf_block_get_frame(block);
ut_ad(page_is_leaf(page));
ulint left_page_no = fil_page_get_prev(page);
ulint right_page_no = fil_page_get_next(page);
if (left_page_no != FIL_NULL) {
buf_read_page_background(
page_id_t(block->page.id.space(), left_page_no),
block->zip_size(), false);
}
if (right_page_no != FIL_NULL) {
buf_read_page_background(
page_id_t(block->page.id.space(), right_page_no),
block->zip_size(), false);
}
const page_t *page= block->frame;
ut_ad(page_is_leaf(page));
uint32_t left_page_no= mach_read_from_4(my_assume_aligned<4>
(page + FIL_PAGE_PREV));
uint32_t right_page_no= mach_read_from_4(my_assume_aligned<4>
(page + FIL_PAGE_NEXT));
if (left_page_no != FIL_NULL)
buf_read_page_background(page_id_t(block->page.id.space(), left_page_no),
block->zip_size(), false);
if (right_page_no != FIL_NULL)
buf_read_page_background(page_id_t(block->page.id.space(), right_page_no),
block->zip_size(), false);
}
/*************************************************************//**
......
......@@ -662,7 +662,7 @@ buf_dblwr_process()
recv_dblwr.pages.clear();
fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
fil_flush_file_spaces();
aligned_free(read_buf);
}
......@@ -714,7 +714,7 @@ buf_dblwr_update(
mutex_exit(&buf_dblwr->mutex);
/* This will finish the batch. Sync data files
to the disk. */
fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
fil_flush_file_spaces();
mutex_enter(&buf_dblwr->mutex);
/* We can now reuse the doublewrite memory buffer: */
......@@ -912,7 +912,7 @@ buf_dblwr_flush_buffered_writes()
/* Sync the writes to the disk. */
buf_dblwr_sync_datafiles();
/* Now we flush the data to disk (for example, with fsync) */
fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
fil_flush_file_spaces();
return;
}
......
......@@ -1927,7 +1927,7 @@ buf_flush_stats(
/** Start a buffer flush batch for LRU or flush list
@param[in] flush_type BUF_FLUSH_LRU or BUF_FLUSH_LIST
@return whether the flush batch was started (was not already running) */
bool buf_flush_start(buf_flush_t flush_type)
static bool buf_flush_start(buf_flush_t flush_type)
{
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST);
......@@ -1954,7 +1954,7 @@ bool buf_flush_start(buf_flush_t flush_type)
/** End a buffer flush batch.
@param[in] flush_type BUF_FLUSH_LRU or BUF_FLUSH_LIST */
void buf_flush_end(buf_flush_t flush_type)
static void buf_flush_end(buf_flush_t flush_type)
{
mutex_enter(&buf_pool.mutex);
......
......@@ -630,9 +630,10 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
prevent deadlocks. Even if we read values which are nonsense, the
algorithm will work. */
pred_offset = fil_page_get_prev(frame);
succ_offset = fil_page_get_next(frame);
pred_offset = mach_read_from_4(my_assume_aligned<4>(FIL_PAGE_PREV
+ frame));
succ_offset = mach_read_from_4(my_assume_aligned<4>(FIL_PAGE_NEXT
+ frame));
mutex_exit(&buf_pool.mutex);
if ((page_id.page_no() == low)
......
......@@ -916,7 +916,7 @@ fil_mutex_enter_and_prepare_for_io(
os_thread_sleep(20000);
/* Flush tablespaces so that we can
close modified files in the LRU list */
fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
fil_flush_file_spaces();
count++;
mutex_enter(&fil_system.mutex);
......@@ -1722,7 +1722,7 @@ fil_write_flushed_lsn(
}
err = fil_write(page_id, 0, 0, srv_page_size, buf);
fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
fil_flush_file_spaces();
}
aligned_free(buf);
......@@ -4220,17 +4220,12 @@ fil_flush(fil_space_t* space)
}
/** Flush to disk the writes in file spaces of the given type
possibly cached by the OS.
@param[in] purpose FIL_TYPE_TABLESPACE */
void
fil_flush_file_spaces(
fil_type_t purpose)
possibly cached by the OS. */
void fil_flush_file_spaces()
{
ulint* space_ids;
ulint n_space_ids;
ut_ad(purpose == FIL_TYPE_TABLESPACE);
mutex_enter(&fil_system.mutex);
n_space_ids = fil_system.unflushed_spaces.size();
......@@ -4250,7 +4245,7 @@ fil_flush_file_spaces(
end = fil_system.unflushed_spaces.end();
it != end; ++it) {
if (it->purpose == purpose && !it->is_stopping()) {
if (it->purpose == FIL_TYPE_TABLESPACE && !it->is_stopping()) {
space_ids[n_space_ids++] = it->id;
}
}
......@@ -4306,9 +4301,7 @@ struct Check {
/******************************************************************//**
Checks the consistency of the tablespace cache.
@return true if ok */
bool
fil_validate(void)
/*==============*/
bool fil_validate()
{
fil_space_t* space;
fil_node_t* fil_node;
......@@ -4349,39 +4342,6 @@ fil_validate(void)
return(true);
}
/********************************************************************//**
Returns true if file address is undefined.
@return true if undefined */
bool
fil_addr_is_null(
/*=============*/
fil_addr_t addr) /*!< in: address */
{
return(addr.page == FIL_NULL);
}
/********************************************************************//**
Get the predecessor of a file page.
@return FIL_PAGE_PREV */
ulint
fil_page_get_prev(
/*==============*/
const byte* page) /*!< in: file page */
{
return(mach_read_from_4(page + FIL_PAGE_PREV));
}
/********************************************************************//**
Get the successor of a file page.
@return FIL_PAGE_NEXT */
ulint
fil_page_get_next(
/*==============*/
const byte* page) /*!< in: file page */
{
return(mach_read_from_4(page + FIL_PAGE_NEXT));
}
/*********************************************************************//**
Sets the file page type. */
void
......
......@@ -990,16 +990,14 @@ fsp_alloc_free_extent(
first = flst_get_first(FSP_HEADER_OFFSET + FSP_FREE
+ header->frame);
if (fil_addr_is_null(first)) {
if (first.page == FIL_NULL) {
fsp_fill_free_list(false, space, header, mtr);
first = flst_get_first(FSP_HEADER_OFFSET + FSP_FREE
+ header->frame);
}
if (fil_addr_is_null(first)) {
return(NULL); /* No free extents left */
if (first.page == FIL_NULL) {
return nullptr; /* No free extents left */
}
}
descr = xdes_lst_get_descriptor(space, first, &desc_block,
......@@ -1125,7 +1123,7 @@ fsp_alloc_free_page(
first = flst_get_first(FSP_HEADER_OFFSET + FSP_FREE_FRAG
+ block->frame);
if (fil_addr_is_null(first)) {
if (first.page == FIL_NULL) {
/* There are no partially full fragments: allocate
a free extent and add it to the FREE_FRAG list. NOTE
that the allocation may have as a side-effect that an
......
......@@ -149,7 +149,7 @@ static void flst_insert_after(buf_block_t *base, uint16_t boffset,
flst_write_addr(*add, add->frame + aoffset + FLST_NEXT,
next_addr.page, next_addr.boffset, mtr);
if (fil_addr_is_null(next_addr))
if (next_addr.page == FIL_NULL)
flst_write_addr(*base, base->frame + boffset + FLST_LAST,
add->page.id.page_no(), aoffset, mtr);
else
......@@ -203,7 +203,7 @@ static void flst_insert_before(buf_block_t *base, uint16_t boffset,
flst_write_addr(*add, add->frame + aoffset + FLST_NEXT,
cur->page.id.page_no(), coffset, mtr);
if (fil_addr_is_null(prev_addr))
if (prev_addr.page == FIL_NULL)
flst_write_addr(*base, base->frame + boffset + FLST_FIRST,
add->page.id.page_no(), aoffset, mtr);
else
......@@ -326,7 +326,7 @@ void flst_remove(buf_block_t *base, uint16_t boffset,
const fil_addr_t prev_addr= flst_get_prev_addr(cur->frame + coffset);
const fil_addr_t next_addr= flst_get_next_addr(cur->frame + coffset);
if (fil_addr_is_null(prev_addr))
if (prev_addr.page == FIL_NULL)
flst_write_addr(*base, base->frame + boffset + FLST_FIRST,
next_addr.page, next_addr.boffset, mtr);
else
......@@ -340,7 +340,7 @@ void flst_remove(buf_block_t *base, uint16_t boffset,
next_addr.page, next_addr.boffset, mtr);
}
if (fil_addr_is_null(next_addr))
if (next_addr.page == FIL_NULL)
flst_write_addr(*base, base->frame + boffset + FLST_LAST,
prev_addr.page, prev_addr.boffset, mtr);
else
......@@ -388,7 +388,7 @@ void flst_validate(const buf_block_t *base, uint16_t boffset, mtr_t *mtr)
mtr2.commit();
}
ut_ad(fil_addr_is_null(addr));
ut_ad(addr.page == FIL_NULL);
addr= flst_get_last(base->frame + boffset);
......@@ -402,6 +402,6 @@ void flst_validate(const buf_block_t *base, uint16_t boffset, mtr_t *mtr)
mtr2.commit();
}
ut_ad(fil_addr_is_null(addr));
ut_ad(addr.page == FIL_NULL);
}
#endif
......@@ -229,14 +229,6 @@ void buf_flush_sync();
@param[in] lsn_limit upper limit of LSN to be flushed */
void buf_flush_request_force(lsn_t lsn_limit);
/** Start a buffer flush batch for LRU or flush list
@param[in] flush_type BUF_FLUSH_LRU or BUF_FLUSH_LIST
@return whether the flush batch was started (was not already running) */
bool buf_flush_start(buf_flush_t flush_type);
/** End a buffer flush batch.
@param[in] flush_type BUF_FLUSH_LRU or BUF_FLUSH_LIST */
void buf_flush_end(buf_flush_t flush_type);
#include "buf0flu.ic"
#endif
......@@ -1398,38 +1398,12 @@ void
fil_flush(fil_space_t* space);
/** Flush to disk the writes in file spaces of the given type
possibly cached by the OS.
@param[in] purpose FIL_TYPE_TABLESPACE */
void
fil_flush_file_spaces(
fil_type_t purpose);
possibly cached by the OS. */
void fil_flush_file_spaces();
/******************************************************************//**
Checks the consistency of the tablespace cache.
@return true if ok */
bool
fil_validate(void);
/*==============*/
/********************************************************************//**
Returns true if file address is undefined.
@return true if undefined */
bool
fil_addr_is_null(
/*=============*/
fil_addr_t addr); /*!< in: address */
/********************************************************************//**
Get the predecessor of a file page.
@return FIL_PAGE_PREV */
ulint
fil_page_get_prev(
/*==============*/
const byte* page); /*!< in: file page */
/********************************************************************//**
Get the successor of a file page.
@return FIL_PAGE_NEXT */
ulint
fil_page_get_next(
/*==============*/
const byte* page); /*!< in: file page */
bool fil_validate();
/*********************************************************************//**
Sets the file page type. */
void
......
......@@ -1348,7 +1348,7 @@ bool log_checkpoint()
#ifdef _WIN32
case SRV_ALL_O_DIRECT_FSYNC:
#endif
fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
fil_flush_file_spaces();
}
log_mutex_enter();
......
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