From 6dfab3f31f43f6ac568a4461eb565b12a8844cce Mon Sep 17 00:00:00 2001 From: marko Date: Wed, 1 Mar 2006 11:38:25 +0000 Subject: [PATCH] branches/zip: Move some private functions from page0zip.ic and page0zip.h to page0zip.c. --- include/page0zip.h | 61 ----------------------- include/page0zip.ic | 116 -------------------------------------------- page/page0zip.c | 116 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+), 177 deletions(-) diff --git a/include/page0zip.h b/include/page0zip.h index 34c513d2cb2..a59bb0b55ef 100644 --- a/include/page0zip.h +++ b/include/page0zip.h @@ -84,67 +84,6 @@ page_zip_validate( __attribute__((nonnull)); #endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */ -/***************************************************************** -Gets the size of the compressed page trailer (the dense page directory), -including deleted records (the free list). */ -UNIV_INLINE -ulint -page_zip_dir_size( -/*==============*/ - /* out: length of dense page - directory, in bytes */ - const page_zip_des_t* page_zip) /* in: compressed page */ - __attribute__((pure)); -/***************************************************************** -Gets the size of the compressed page trailer (the dense page directory), -only including user records (excluding the free list). */ -UNIV_INLINE -ulint -page_zip_dir_user_size( -/*===================*/ - /* out: length of dense page - directory, in bytes */ - const page_zip_des_t* page_zip) /* in: compressed page */ - __attribute__((pure)); - -/***************************************************************** -Find the slot of the given non-free record in the dense page directory. */ -UNIV_INLINE -byte* -page_zip_dir_find( -/*==============*/ - /* out: dense directory slot, - or NULL if record not found */ - page_zip_des_t* page_zip, /* in: compressed page */ - ulint offset) /* in: offset of user record */ - __attribute__((pure)); -/***************************************************************** -Find the slot of the given free record in the dense page directory. */ -UNIV_INLINE -byte* -page_zip_dir_find_free( -/*===================*/ - /* out: dense directory slot, - or NULL if record not found */ - page_zip_des_t* page_zip, /* in: compressed page */ - ulint offset) /* in: offset of user record */ - __attribute__((pure)); -/***************************************************************** -Read a given slot in the dense page directory. */ -UNIV_INLINE -ulint -page_zip_dir_get( -/*=============*/ - /* out: record offset - on the uncompressed page, - possibly ORed with - PAGE_ZIP_DIR_SLOT_DEL or - PAGE_ZIP_DIR_SLOT_OWNED */ - const page_zip_des_t* page_zip, /* in: compressed page */ - ulint slot) /* in: slot - (0=first user record) */ - __attribute__((pure)); - /************************************************************************** Ensure that enough space is available in the modification log. If not, try to compress the page. */ diff --git a/include/page0zip.ic b/include/page0zip.ic index 0316f1220e8..5460f434ee3 100644 --- a/include/page0zip.ic +++ b/include/page0zip.ic @@ -140,122 +140,6 @@ page_zip_simple_validate( } #endif /* UNIV_DEBUG */ -/***************************************************************** -Gets the size of the compressed page trailer (the dense page directory), -including deleted records (the free list). */ -UNIV_INLINE -ulint -page_zip_dir_size( -/*==============*/ - /* out: length of dense page - directory, in bytes */ - const page_zip_des_t* page_zip) /* in: compressed page */ -{ - /* Exclude the page infimum and supremum from the record count. */ - ulint size = PAGE_ZIP_DIR_SLOT_SIZE - * (page_dir_get_n_heap((page_t*) page_zip->data) - 2); - ut_ad(page_zip->m_end + size < page_zip->size); - return(size); -} - -/***************************************************************** -Gets the size of the compressed page trailer (the dense page directory), -only including user records (excluding the free list). */ -UNIV_INLINE -ulint -page_zip_dir_user_size( -/*===================*/ - /* out: length of dense page - directory comprising existing - records, in bytes */ - const page_zip_des_t* page_zip) /* in: compressed page */ -{ - ulint size = PAGE_ZIP_DIR_SLOT_SIZE - * page_get_n_recs((page_t*) page_zip->data); - ut_ad(size < page_zip_dir_size(page_zip)); - return(size); -} - -/***************************************************************** -Find the slot of the given non-free record in the dense page directory. */ -UNIV_INLINE -byte* -page_zip_dir_find( -/*==============*/ - /* out: dense directory slot, - or NULL if record not found */ - page_zip_des_t* page_zip, /* in: compressed page */ - ulint offset) /* in: offset of user record */ -{ - byte* slot; - byte* end; - - ut_ad(page_zip_simple_validate(page_zip)); - - end = page_zip->data + page_zip->size - PAGE_ZIP_DIR_SLOT_SIZE; - slot = end - page_zip_dir_user_size(page_zip); - - for (; slot < end; slot += PAGE_ZIP_DIR_SLOT_SIZE) { - if ((mach_read_from_2(slot) & PAGE_ZIP_DIR_SLOT_MASK) - == offset) { - return(slot); - } - } - - return(NULL); -} - -/***************************************************************** -Find the slot of the given free record in the dense page directory. */ -UNIV_INLINE -byte* -page_zip_dir_find_free( -/*===================*/ - /* out: dense directory slot, - or NULL if record not found */ - page_zip_des_t* page_zip, /* in: compressed page */ - ulint offset) /* in: offset of user record */ -{ - byte* slot; - byte* end; - - ut_ad(page_zip_simple_validate(page_zip)); - - slot = end = page_zip->data + page_zip->size; - slot -= page_zip_dir_size(page_zip); - end -= PAGE_ZIP_DIR_SLOT_SIZE + page_zip_dir_user_size(page_zip); - - for (; slot < end; slot += PAGE_ZIP_DIR_SLOT_SIZE) { - if ((mach_read_from_2(slot) & PAGE_ZIP_DIR_SLOT_MASK) - == offset) { - return(slot); - } - } - - return(NULL); -} - -/***************************************************************** -Read a given slot in the dense page directory. */ -UNIV_INLINE -ulint -page_zip_dir_get( -/*=============*/ - /* out: record offset - on the uncompressed page, - possibly ORed with - PAGE_ZIP_DIR_SLOT_DEL or - PAGE_ZIP_DIR_SLOT_OWNED */ - const page_zip_des_t* page_zip, /* in: compressed page */ - ulint slot) /* in: slot - (0=first user record) */ -{ - ut_ad(page_zip_simple_validate(page_zip)); - ut_ad(slot < page_zip_dir_size(page_zip) / PAGE_ZIP_DIR_SLOT_SIZE); - return(mach_read_from_2(page_zip->data + page_zip->size - - PAGE_ZIP_DIR_SLOT_SIZE * (slot + 1))); -} - /************************************************************************** Ensure that enough space is available in the modification log. If not, try to compress the page. */ diff --git a/page/page0zip.c b/page/page0zip.c index 642b2a5cac3..d7acfb4e2a2 100644 --- a/page/page0zip.c +++ b/page/page0zip.c @@ -43,6 +43,122 @@ static const byte supremum_extra_data[] = { 0x65, 0x6d, 0x75, 0x6d /* "supremum" */ }; +/***************************************************************** +Gets the size of the compressed page trailer (the dense page directory), +including deleted records (the free list). */ +UNIV_INLINE +ulint +page_zip_dir_size( +/*==============*/ + /* out: length of dense page + directory, in bytes */ + const page_zip_des_t* page_zip) /* in: compressed page */ +{ + /* Exclude the page infimum and supremum from the record count. */ + ulint size = PAGE_ZIP_DIR_SLOT_SIZE + * (page_dir_get_n_heap((page_t*) page_zip->data) - 2); + ut_ad(page_zip->m_end + size < page_zip->size); + return(size); +} + +/***************************************************************** +Gets the size of the compressed page trailer (the dense page directory), +only including user records (excluding the free list). */ +UNIV_INLINE +ulint +page_zip_dir_user_size( +/*===================*/ + /* out: length of dense page + directory comprising existing + records, in bytes */ + const page_zip_des_t* page_zip) /* in: compressed page */ +{ + ulint size = PAGE_ZIP_DIR_SLOT_SIZE + * page_get_n_recs((page_t*) page_zip->data); + ut_ad(size < page_zip_dir_size(page_zip)); + return(size); +} + +/***************************************************************** +Find the slot of the given non-free record in the dense page directory. */ +UNIV_INLINE +byte* +page_zip_dir_find( +/*==============*/ + /* out: dense directory slot, + or NULL if record not found */ + page_zip_des_t* page_zip, /* in: compressed page */ + ulint offset) /* in: offset of user record */ +{ + byte* slot; + byte* end; + + ut_ad(page_zip_simple_validate(page_zip)); + + end = page_zip->data + page_zip->size - PAGE_ZIP_DIR_SLOT_SIZE; + slot = end - page_zip_dir_user_size(page_zip); + + for (; slot < end; slot += PAGE_ZIP_DIR_SLOT_SIZE) { + if ((mach_read_from_2(slot) & PAGE_ZIP_DIR_SLOT_MASK) + == offset) { + return(slot); + } + } + + return(NULL); +} + +/***************************************************************** +Find the slot of the given free record in the dense page directory. */ +UNIV_INLINE +byte* +page_zip_dir_find_free( +/*===================*/ + /* out: dense directory slot, + or NULL if record not found */ + page_zip_des_t* page_zip, /* in: compressed page */ + ulint offset) /* in: offset of user record */ +{ + byte* slot; + byte* end; + + ut_ad(page_zip_simple_validate(page_zip)); + + slot = end = page_zip->data + page_zip->size; + slot -= page_zip_dir_size(page_zip); + end -= PAGE_ZIP_DIR_SLOT_SIZE + page_zip_dir_user_size(page_zip); + + for (; slot < end; slot += PAGE_ZIP_DIR_SLOT_SIZE) { + if ((mach_read_from_2(slot) & PAGE_ZIP_DIR_SLOT_MASK) + == offset) { + return(slot); + } + } + + return(NULL); +} + +/***************************************************************** +Read a given slot in the dense page directory. */ +UNIV_INLINE +ulint +page_zip_dir_get( +/*=============*/ + /* out: record offset + on the uncompressed page, + possibly ORed with + PAGE_ZIP_DIR_SLOT_DEL or + PAGE_ZIP_DIR_SLOT_OWNED */ + const page_zip_des_t* page_zip, /* in: compressed page */ + ulint slot) /* in: slot + (0=first user record) */ +{ + ut_ad(page_zip_simple_validate(page_zip)); + ut_ad(slot < page_zip_dir_size(page_zip) / PAGE_ZIP_DIR_SLOT_SIZE); + return(mach_read_from_2(page_zip->data + page_zip->size + - PAGE_ZIP_DIR_SLOT_SIZE * (slot + 1))); +} + /************************************************************************** Encode the length of a fixed-length column. */ static