summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-05-05 07:06:37 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-05-05 07:06:37 +0300
commit64488a6f2dd6aa43462292b757e783cfba11a8c6 (patch)
treebb8ded4dc80d4612bd4f7c19090739acbf25f277 /storage
parent97261cbb7a5961c38f973ba63fdc007d1992d931 (diff)
downloadmariadb-git-64488a6f2dd6aa43462292b757e783cfba11a8c6.tar.gz
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.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/btr/btr0cur.cc36
-rw-r--r--storage/innobase/buf/buf0dblwr.cc6
-rw-r--r--storage/innobase/buf/buf0flu.cc4
-rw-r--r--storage/innobase/buf/buf0rea.cc7
-rw-r--r--storage/innobase/fil/fil0fil.cc52
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc12
-rw-r--r--storage/innobase/fut/fut0lst.cc12
-rw-r--r--storage/innobase/include/buf0flu.h8
-rw-r--r--storage/innobase/include/fil0fil.h32
-rw-r--r--storage/innobase/log/log0log.cc2
10 files changed, 45 insertions, 126 deletions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 69bd2ecff0b..d8e9436e34a 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -3308,28 +3308,22 @@ upd_sys:
/**
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);
}
/*************************************************************//**
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index c83d21e2e12..38160a9e4a7 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -662,7 +662,7 @@ bad:
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;
}
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 741cc5d8eb1..54d01591202 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -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);
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index adecbf3cfe1..b4bb5bc56a0 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -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)
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 715f819d723..b71626aa0cd 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -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
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 7d970c12814..839c5e3250b 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -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
diff --git a/storage/innobase/fut/fut0lst.cc b/storage/innobase/fut/fut0lst.cc
index c75d2670181..0a54d51b462 100644
--- a/storage/innobase/fut/fut0lst.cc
+++ b/storage/innobase/fut/fut0lst.cc
@@ -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
diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h
index becf2d052ed..eb6351fb244 100644
--- a/storage/innobase/include/buf0flu.h
+++ b/storage/innobase/include/buf0flu.h
@@ -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
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 531b70d1a40..e476a1e75cb 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -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
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 7d4aa7bc070..3c30bae6ad9 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -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();