Commit 40d2bc7d authored by marko's avatar marko

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.
parent 7507c217
......@@ -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);
}
......
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