diff options
Diffstat (limited to 'storage/innobase/log/log0log.cc')
-rw-r--r-- | storage/innobase/log/log0log.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 708200bfada..a6f8ea99dcf 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -193,10 +193,8 @@ void log_buffer_extend(ulong len) log_sys.is_extending = true; - while (ut_calc_align_down(log_sys.buf_free, - OS_FILE_LOG_BLOCK_SIZE) - != ut_calc_align_down(log_sys.buf_next_to_write, - OS_FILE_LOG_BLOCK_SIZE)) { + while ((log_sys.buf_free ^ log_sys.buf_next_to_write) + & (OS_FILE_LOG_BLOCK_SIZE - 1)) { /* Buffer might have >1 blocks to write still. */ log_mutex_exit_all(); @@ -205,9 +203,8 @@ void log_buffer_extend(ulong len) log_mutex_enter_all(); } - ulong move_start = ut_calc_align_down( - log_sys.buf_free, - OS_FILE_LOG_BLOCK_SIZE); + ulong move_start = ut_2pow_round(log_sys.buf_free, + ulong(OS_FILE_LOG_BLOCK_SIZE)); ulong move_end = log_sys.buf_free; /* store the last log block in buffer */ @@ -896,8 +893,8 @@ log_buffer_switch() ut_ad(log_write_mutex_own()); const byte* old_buf = log_sys.buf; - ulint area_end = ut_calc_align(log_sys.buf_free, - OS_FILE_LOG_BLOCK_SIZE); + ulong area_end = ut_calc_align( + log_sys.buf_free, ulong(OS_FILE_LOG_BLOCK_SIZE)); if (log_sys.first_in_use) { log_sys.first_in_use = false; @@ -1031,8 +1028,9 @@ loop: start_offset = log_sys.buf_next_to_write; end_offset = log_sys.buf_free; - area_start = ut_calc_align_down(start_offset, OS_FILE_LOG_BLOCK_SIZE); - area_end = ut_calc_align(end_offset, OS_FILE_LOG_BLOCK_SIZE); + area_start = ut_2pow_round(start_offset, + ulint(OS_FILE_LOG_BLOCK_SIZE)); + area_end = ut_calc_align(end_offset, ulint(OS_FILE_LOG_BLOCK_SIZE)); ut_ad(area_end - area_start > 0); |