mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 03:51:50 +01:00
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
This commit is contained in:
parent
4fed8f71e0
commit
5d0917401b
1 changed files with 7 additions and 5 deletions
|
@ -766,6 +766,7 @@ buf_flush_try_page(
|
|||
buf_page_t* bpage;
|
||||
mutex_t* block_mutex;
|
||||
ibool locked;
|
||||
ibool is_uncompressed;
|
||||
|
||||
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST
|
||||
|| flush_type == BUF_FLUSH_SINGLE_PAGE);
|
||||
|
@ -801,6 +802,8 @@ buf_flush_try_page(
|
|||
|
||||
buf_pool->n_flush[flush_type]++;
|
||||
|
||||
is_uncompressed = buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE;
|
||||
|
||||
switch (flush_type) {
|
||||
case BUF_FLUSH_LIST:
|
||||
/* If the simulated aio thread is not running, we must
|
||||
|
@ -808,8 +811,7 @@ buf_flush_try_page(
|
|||
if buf_fix_count == 0, then we know we need not wait */
|
||||
|
||||
locked = bpage->buf_fix_count == 0;
|
||||
if (locked
|
||||
&& buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) {
|
||||
if (locked && is_uncompressed) {
|
||||
rw_lock_s_lock_gen(&((buf_block_t*) bpage)->lock,
|
||||
BUF_IO_WRITE);
|
||||
}
|
||||
|
@ -820,7 +822,7 @@ buf_flush_try_page(
|
|||
if (!locked) {
|
||||
buf_flush_buffered_writes();
|
||||
|
||||
if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) {
|
||||
if (is_uncompressed) {
|
||||
rw_lock_s_lock_gen(&((buf_block_t*) bpage)
|
||||
->lock, BUF_IO_WRITE);
|
||||
}
|
||||
|
@ -837,7 +839,7 @@ buf_flush_try_page(
|
|||
the page not to be bufferfixed (in function
|
||||
buf_flush_ready_for_flush). */
|
||||
|
||||
if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) {
|
||||
if (is_uncompressed) {
|
||||
rw_lock_s_lock_gen(&((buf_block_t*) bpage)->lock,
|
||||
BUF_IO_WRITE);
|
||||
}
|
||||
|
@ -854,7 +856,7 @@ buf_flush_try_page(
|
|||
mutex_exit(block_mutex);
|
||||
buf_pool_mutex_exit();
|
||||
|
||||
if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) {
|
||||
if (is_uncompressed) {
|
||||
rw_lock_s_lock_gen(&((buf_block_t*) bpage)->lock,
|
||||
BUF_IO_WRITE);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue