summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-11-02 22:51:34 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-11-06 18:08:33 +0200
commit57ba66b9abdaa513f6f9e2dbfd953ebd59106145 (patch)
tree7336c45ac8e33da05a3de090fec5d2a1ecc7bd73
parent9f3c014ca3e5b58cfbbe33ee6ffccbb99cc4a356 (diff)
downloadmariadb-git-57ba66b9abdaa513f6f9e2dbfd953ebd59106145.tar.gz
Remove redundant function parameters
buf_flush_or_remove_pages(), buf_flush_dirty_pages(): Remove the redundant parameter flush=(trx!=NULL).
-rw-r--r--storage/innobase/buf/buf0lru.cc63
-rw-r--r--storage/xtradb/buf/buf0lru.cc63
2 files changed, 52 insertions, 74 deletions
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index 8c2b5df4bce..98f20f444cb 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -528,26 +528,20 @@ buf_flush_or_remove_page(
return(processed);
}
-/******************************************************************//**
-Remove all dirty pages belonging to a given tablespace inside a specific
+/** Remove all dirty pages belonging to a given tablespace inside a specific
buffer pool instance when we are deleting the data file(s) of that
tablespace. The pages still remain a part of LRU and are evicted from
the list as they age towards the tail of the LRU.
+@param[in,out] buf_pool buffer pool
+@param[in] id tablespace identifier
+@param[in] trx transaction (to check for interrupt),
+ or NULL if the files should not be written to
@retval DB_SUCCESS if all freed
@retval DB_FAIL if not all freed
@retval DB_INTERRUPTED if the transaction was interrupted */
static MY_ATTRIBUTE((nonnull(1), warn_unused_result))
dberr_t
-buf_flush_or_remove_pages(
-/*======================*/
- buf_pool_t* buf_pool, /*!< buffer pool instance */
- ulint id, /*!< in: target space id for which
- to remove or flush pages */
- bool flush, /*!< in: flush to disk if true but
- don't remove else remove without
- flushing to disk */
- const trx_t* trx) /*!< to check if the operation must
- be interrupted, can be 0 */
+buf_flush_or_remove_pages(buf_pool_t* buf_pool, ulint id, const trx_t* trx)
{
buf_page_t* prev;
buf_page_t* bpage;
@@ -574,7 +568,7 @@ rescan:
/* Skip this block, as it does not belong to
the target space. */
- } else if (!buf_flush_or_remove_page(buf_pool, bpage, flush)) {
+ } else if (!buf_flush_or_remove_page(buf_pool, bpage, trx)) {
/* Remove was unsuccessful, we have to try again
by scanning the entire list from the end.
@@ -597,7 +591,7 @@ rescan:
iteration. */
all_freed = false;
- } else if (flush) {
+ } else if (trx) {
/* The processing was successful. And during the
processing we have released the buf_pool mutex
@@ -616,19 +610,17 @@ rescan:
processed = 0;
}
-#ifdef DBUG_OFF
- if (flush) {
+ if (trx) {
DBUG_EXECUTE_IF("ib_export_flush_crash",
static ulint n_pages;
if (++n_pages == 4) {DBUG_SUICIDE();});
- }
-#endif /* DBUG_OFF */
- /* The check for trx is interrupted is expensive, we want
- to check every N iterations. */
- if (!processed && trx && trx_is_interrupted(trx)) {
- buf_flush_list_mutex_exit(buf_pool);
- return(DB_INTERRUPTED);
+ /* The check for trx is interrupted is
+ expensive, we want to check every N iterations. */
+ if (!processed && trx_is_interrupted(trx)) {
+ buf_flush_list_mutex_exit(buf_pool);
+ return(DB_INTERRUPTED);
+ }
}
}
@@ -637,28 +629,25 @@ rescan:
return(all_freed ? DB_SUCCESS : DB_FAIL);
}
-/******************************************************************//**
-Remove or flush all the dirty pages that belong to a given tablespace
+/** Remove or flush all the dirty pages that belong to a given tablespace
inside a specific buffer pool instance. The pages will remain in the LRU
list and will be evicted from the LRU list as they age and move towards
-the tail of the LRU list. */
+the tail of the LRU list.
+@param[in,out] buf_pool buffer pool
+@param[in] id tablespace identifier
+@param[in] trx transaction (to check for interrupt),
+ or NULL if the files should not be written to
+*/
static MY_ATTRIBUTE((nonnull(1)))
void
-buf_flush_dirty_pages(
-/*==================*/
- buf_pool_t* buf_pool, /*!< buffer pool instance */
- ulint id, /*!< in: space id */
- bool flush, /*!< in: flush to disk if true otherwise
- remove the pages without flushing */
- const trx_t* trx) /*!< to check if the operation must
- be interrupted */
+buf_flush_dirty_pages(buf_pool_t* buf_pool, ulint id, const trx_t* trx)
{
dberr_t err;
do {
buf_pool_mutex_enter(buf_pool);
- err = buf_flush_or_remove_pages(buf_pool, id, flush, trx);
+ err = buf_flush_or_remove_pages(buf_pool, id, trx);
buf_pool_mutex_exit(buf_pool);
@@ -847,12 +836,12 @@ buf_LRU_remove_pages(
case BUF_REMOVE_FLUSH_NO_WRITE:
ut_a(trx == 0);
- buf_flush_dirty_pages(buf_pool, id, false, NULL);
+ buf_flush_dirty_pages(buf_pool, id, NULL);
break;
case BUF_REMOVE_FLUSH_WRITE:
ut_a(trx != 0);
- buf_flush_dirty_pages(buf_pool, id, true, trx);
+ buf_flush_dirty_pages(buf_pool, id, trx);
/* Ensure that all asynchronous IO is completed. */
os_aio_wait_until_no_pending_writes();
fil_flush(id);
diff --git a/storage/xtradb/buf/buf0lru.cc b/storage/xtradb/buf/buf0lru.cc
index d979eb44a96..078e5f999f8 100644
--- a/storage/xtradb/buf/buf0lru.cc
+++ b/storage/xtradb/buf/buf0lru.cc
@@ -571,26 +571,20 @@ buf_flush_or_remove_page(
return(processed);
}
-/******************************************************************//**
-Remove all dirty pages belonging to a given tablespace inside a specific
+/** Remove all dirty pages belonging to a given tablespace inside a specific
buffer pool instance when we are deleting the data file(s) of that
tablespace. The pages still remain a part of LRU and are evicted from
the list as they age towards the tail of the LRU.
+@param[in,out] buf_pool buffer pool
+@param[in] id tablespace identifier
+@param[in] trx transaction (to check for interrupt),
+ or NULL if the files should not be written to
@retval DB_SUCCESS if all freed
@retval DB_FAIL if not all freed
@retval DB_INTERRUPTED if the transaction was interrupted */
static MY_ATTRIBUTE((nonnull(1), warn_unused_result))
dberr_t
-buf_flush_or_remove_pages(
-/*======================*/
- buf_pool_t* buf_pool, /*!< buffer pool instance */
- ulint id, /*!< in: target space id for which
- to remove or flush pages */
- bool flush, /*!< in: flush to disk if true but
- don't remove else remove without
- flushing to disk */
- const trx_t* trx) /*!< to check if the operation must
- be interrupted, can be 0 */
+buf_flush_or_remove_pages(buf_pool_t* buf_pool, ulint id, const trx_t* trx)
{
buf_page_t* prev;
buf_page_t* bpage;
@@ -621,7 +615,7 @@ rescan:
/* Skip this block, as it does not belong to
the target space. */
- } else if (!buf_flush_or_remove_page(buf_pool, bpage, flush,
+ } else if (!buf_flush_or_remove_page(buf_pool, bpage, trx,
&must_restart)) {
/* Remove was unsuccessful, we have to try again
@@ -647,7 +641,7 @@ rescan:
/* Cannot trust the prev pointer */
break;
}
- } else if (flush) {
+ } else if (trx) {
/* The processing was successful. And during the
processing we have released all the buf_pool mutexes
@@ -674,19 +668,17 @@ rescan:
break;
}
-#ifdef DBUG_OFF
- if (flush) {
+ if (trx) {
DBUG_EXECUTE_IF("ib_export_flush_crash",
static ulint n_pages;
if (++n_pages == 4) {DBUG_SUICIDE();});
- }
-#endif /* DBUG_OFF */
- /* The check for trx is interrupted is expensive, we want
- to check every N iterations. */
- if (!processed && trx && trx_is_interrupted(trx)) {
- buf_flush_list_mutex_exit(buf_pool);
- return(DB_INTERRUPTED);
+ /* The check for trx is interrupted is
+ expensive, we want to check every N iterations. */
+ if (!processed && trx_is_interrupted(trx)) {
+ buf_flush_list_mutex_exit(buf_pool);
+ return(DB_INTERRUPTED);
+ }
}
}
@@ -695,28 +687,25 @@ rescan:
return(all_freed ? DB_SUCCESS : DB_FAIL);
}
-/******************************************************************//**
-Remove or flush all the dirty pages that belong to a given tablespace
+/** Remove or flush all the dirty pages that belong to a given tablespace
inside a specific buffer pool instance. The pages will remain in the LRU
list and will be evicted from the LRU list as they age and move towards
-the tail of the LRU list. */
+the tail of the LRU list.
+@param[in,out] buf_pool buffer pool
+@param[in] id tablespace identifier
+@param[in] trx transaction (to check for interrupt),
+ or NULL if the files should not be written to
+*/
static MY_ATTRIBUTE((nonnull(1)))
void
-buf_flush_dirty_pages(
-/*==================*/
- buf_pool_t* buf_pool, /*!< buffer pool instance */
- ulint id, /*!< in: space id */
- bool flush, /*!< in: flush to disk if true otherwise
- remove the pages without flushing */
- const trx_t* trx) /*!< to check if the operation must
- be interrupted */
+buf_flush_dirty_pages(buf_pool_t* buf_pool, ulint id, const trx_t* trx)
{
dberr_t err;
do {
mutex_enter(&buf_pool->LRU_list_mutex);
- err = buf_flush_or_remove_pages(buf_pool, id, flush, trx);
+ err = buf_flush_or_remove_pages(buf_pool, id, trx);
mutex_exit(&buf_pool->LRU_list_mutex);
@@ -913,12 +902,12 @@ buf_LRU_remove_pages(
case BUF_REMOVE_FLUSH_NO_WRITE:
ut_a(trx == 0);
- buf_flush_dirty_pages(buf_pool, id, false, NULL);
+ buf_flush_dirty_pages(buf_pool, id, NULL);
break;
case BUF_REMOVE_FLUSH_WRITE:
ut_a(trx != 0);
- buf_flush_dirty_pages(buf_pool, id, true, trx);
+ buf_flush_dirty_pages(buf_pool, id, trx);
/* Ensure that all asynchronous IO is completed. */
os_aio_wait_until_no_pending_writes();
fil_flush(id);