summaryrefslogtreecommitdiff
path: root/storage/innobase/buf/buf0flu.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/buf/buf0flu.cc')
-rw-r--r--storage/innobase/buf/buf0flu.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index d1a55bae456..92ba84d04ac 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -369,11 +369,8 @@ void buf_page_write_complete(const IORequest &request)
buf_dblwr.write_completed();
}
- /* Because this thread which does the unlocking might not be the same that
- did the locking, we use a pass value != 0 in unlock, which simply
- removes the newest lock debug record, without checking the thread id. */
if (bpage->state() == BUF_BLOCK_FILE_PAGE)
- rw_lock_sx_unlock_gen(&((buf_block_t*) bpage)->lock, BUF_IO_WRITE);
+ reinterpret_cast<buf_block_t*>(bpage)->lock.u_unlock(true);
buf_pool.stat.n_pages_written++;
@@ -792,8 +789,7 @@ static void buf_release_freed_page(buf_page_t *bpage)
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
if (uncompressed)
- rw_lock_sx_unlock_gen(&reinterpret_cast<buf_block_t*>(bpage)->lock,
- BUF_IO_WRITE);
+ reinterpret_cast<buf_block_t*>(bpage)->lock.u_unlock(true);
buf_LRU_free_page(bpage, true);
mysql_mutex_unlock(&buf_pool.mutex);
@@ -815,14 +811,14 @@ static bool buf_flush_page(buf_page_t *bpage, bool lru, fil_space_t *space)
space->atomic_write_supported);
ut_ad(space->referenced());
- rw_lock_t *rw_lock;
+ block_lock *rw_lock;
if (bpage->state() != BUF_BLOCK_FILE_PAGE)
rw_lock= nullptr;
else
{
rw_lock= &reinterpret_cast<buf_block_t*>(bpage)->lock;
- if (!rw_lock_sx_lock_nowait(rw_lock, BUF_IO_WRITE))
+ if (!rw_lock->u_lock_try(true))
return false;
}
@@ -870,7 +866,7 @@ static bool buf_flush_page(buf_page_t *bpage, bool lru, fil_space_t *space)
if (UNIV_UNLIKELY(lsn > log_sys.get_flushed_lsn()))
{
if (rw_lock)
- rw_lock_sx_unlock_gen(rw_lock, BUF_IO_WRITE);
+ rw_lock->u_unlock(true);
mysql_mutex_lock(&buf_pool.mutex);
bpage->set_io_fix(BUF_IO_NONE);
return false;
@@ -1221,14 +1217,14 @@ static void buf_flush_discard_page(buf_page_t *bpage)
ut_ad(bpage->in_file());
ut_ad(bpage->oldest_modification());
- rw_lock_t *rw_lock;
+ block_lock *rw_lock;
if (bpage->state() != BUF_BLOCK_FILE_PAGE)
rw_lock= nullptr;
else
{
rw_lock= &reinterpret_cast<buf_block_t*>(bpage)->lock;
- if (!rw_lock_sx_lock_nowait(rw_lock, 0))
+ if (!rw_lock->u_lock_try(false))
return;
}
@@ -1238,7 +1234,7 @@ static void buf_flush_discard_page(buf_page_t *bpage)
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
if (rw_lock)
- rw_lock_sx_unlock(rw_lock);
+ rw_lock->u_unlock();
buf_LRU_free_page(bpage, true);
}