函数fsp_get_space_header

 

/**********************************************************************//**
Gets a pointer to the space header and x-locks its page.
@return    pointer to the space header, page x-locked */
UNIV_INLINE
fsp_header_t*
fsp_get_space_header(
/*=================*/
    ulint    id,    /*!< in: space id */
    ulint    zip_size,/*!< in: compressed page size in bytes
            or 0 for uncompressed pages */
    mtr_t*    mtr)    /*!< in: mtr */
{
    buf_block_t*    block;
    fsp_header_t*    header;

    ut_ad(ut_is_2pow(zip_size));
    ut_ad(zip_size <= UNIV_PAGE_SIZE);
    ut_ad(!zip_size || zip_size >= PAGE_ZIP_MIN_SIZE);
    ut_ad(id || !zip_size);
   
  #define buf_page_get(SP, ZS, OF, LA, MTR) buf_page_get_gen(SP, ZS, OF, LA, NULL,BUF_GET, __FILE__, __LINE__,     MTR)

    block = buf_page_get(id, zip_size, 0, RW_X_LATCH, mtr);//buf_page_get_gen 详见     //#define FSP_HEADER_OFFSET    FIL_PAGE_DATA
    #define FIL_PAGE_DATA        38

    header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
    buf_block_dbg_add_level(block, SYNC_FSP_PAGE);

    //#define FSP_SPACE_ID        0    
    ut_ad(id == mach_read_from_4(FSP_SPACE_ID + header));

    //#define    FSP_SPACE_FLAGS        16    
    ut_ad(zip_size == dict_table_flags_to_zip_size(
              mach_read_from_4(FSP_SPACE_FLAGS + header)));
    return(header);
}

 

你可能感兴趣的:(函数fsp_get_space_header)