diff options
Diffstat (limited to 'buf/buf0rea.c')
-rw-r--r-- | buf/buf0rea.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/buf/buf0rea.c b/buf/buf0rea.c index c5a7def8733..149be7f3bdd 100644 --- a/buf/buf0rea.c +++ b/buf/buf0rea.c @@ -246,22 +246,18 @@ buf_read_ahead_random( LRU_recent_limit = buf_LRU_get_recent_limit(); - //buf_pool_mutex_enter(); - mutex_enter(&buf_pool_mutex); + buf_pool_mutex_enter(); if (buf_pool->n_pend_reads > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) { - //buf_pool_mutex_exit(); - mutex_exit(&buf_pool_mutex); + buf_pool_mutex_exit(); return(0); } - mutex_exit(&buf_pool_mutex); /* Count how many blocks in the area have been recently accessed, that is, reside near the start of the LRU list. */ - rw_lock_s_lock(&page_hash_latch); for (i = low; i < high; i++) { const buf_page_t* bpage = buf_page_hash_get(space, i); @@ -273,15 +269,13 @@ buf_read_ahead_random( if (recent_blocks >= BUF_READ_AHEAD_RANDOM_THRESHOLD) { - //buf_pool_mutex_exit(); - rw_lock_s_unlock(&page_hash_latch); + buf_pool_mutex_exit(); goto read_ahead; } } } - //buf_pool_mutex_exit(); - rw_lock_s_unlock(&page_hash_latch); + buf_pool_mutex_exit(); /* Do nothing */ return(0); @@ -475,12 +469,10 @@ buf_read_ahead_linear( tablespace_version = fil_space_get_version(space); - //buf_pool_mutex_enter(); - mutex_enter(&buf_pool_mutex); + buf_pool_mutex_enter(); if (high > fil_space_get_size(space)) { - //buf_pool_mutex_exit(); - mutex_exit(&buf_pool_mutex); + buf_pool_mutex_exit(); /* The area is not whole, return */ return(0); @@ -488,12 +480,10 @@ buf_read_ahead_linear( if (buf_pool->n_pend_reads > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) { - //buf_pool_mutex_exit(); - mutex_exit(&buf_pool_mutex); + buf_pool_mutex_exit(); return(0); } - mutex_exit(&buf_pool_mutex); /* Check that almost all pages in the area have been accessed; if offset == low, the accesses must be in a descending order, otherwise, @@ -507,7 +497,6 @@ buf_read_ahead_linear( fail_count = 0; - rw_lock_s_lock(&page_hash_latch); for (i = low; i < high; i++) { bpage = buf_page_hash_get(space, i); @@ -531,8 +520,7 @@ buf_read_ahead_linear( * LINEAR_AREA_THRESHOLD_COEF) { /* Too many failures: return */ - //buf_pool_mutex_exit(); - rw_lock_s_unlock(&page_hash_latch); + buf_pool_mutex_exit(); return(0); } @@ -543,8 +531,7 @@ buf_read_ahead_linear( bpage = buf_page_hash_get(space, offset); if (bpage == NULL) { - //buf_pool_mutex_exit(); - rw_lock_s_unlock(&page_hash_latch); + buf_pool_mutex_exit(); return(0); } @@ -570,8 +557,7 @@ buf_read_ahead_linear( pred_offset = fil_page_get_prev(frame); succ_offset = fil_page_get_next(frame); - //buf_pool_mutex_exit(); - rw_lock_s_unlock(&page_hash_latch); + buf_pool_mutex_exit(); if ((offset == low) && (succ_offset == offset + 1)) { |