diff --git a/include/buf0buf.h b/include/buf0buf.h index 42da3469093..d3bbda2a8c9 100644 --- a/include/buf0buf.h +++ b/include/buf0buf.h @@ -738,7 +738,7 @@ ibool buf_page_can_relocate( /*==================*/ const buf_page_t* bpage) /* control block being relocated */ - __attribute__((const)); + __attribute__((pure)); /************************************************************************* Determine if a block has been flagged old. */ @@ -774,6 +774,16 @@ buf_page_set_accessed( /*==================*/ buf_page_t* bpage, /* in/out: control block */ ibool accessed); /* in: accessed */ +/************************************************************************* +Gets the buf_block_t handle of a buffered file block if an uncompressed +page frame exists, or NULL. */ +UNIV_INLINE +const buf_block_t* +buf_page_get_block( +/*===============*/ + /* out: control block, or NULL */ + const buf_page_t* bpage) /* in: control block */ + __attribute__((pure)); #ifdef UNIV_DEBUG /************************************************************************* Gets a pointer to the memory frame of a block. */ diff --git a/include/buf0buf.ic b/include/buf0buf.ic index 711871cd3f2..4781c56cc88 100644 --- a/include/buf0buf.ic +++ b/include/buf0buf.ic @@ -460,6 +460,26 @@ buf_page_set_accessed( bpage->accessed = accessed; } +/************************************************************************* +Gets the buf_block_t handle of a buffered file block if an uncompressed +page frame exists, or NULL. */ +UNIV_INLINE +const buf_block_t* +buf_page_get_block( +/*===============*/ + /* out: control block, or NULL */ + const buf_page_t* bpage) /* in: control block */ +{ + ut_ad(buf_page_in_file(bpage)); + ut_ad(mutex_own(buf_page_get_mutex((buf_page_t*) bpage))); + + if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) { + return((const buf_block_t*) bpage); + } + + return(NULL); +} + #ifdef UNIV_DEBUG /************************************************************************* Gets a pointer to the memory frame of a block. */