结构体buf_page_t

/** Buffer page (uncompressed or compressed) */
typedef    struct buf_page_struct        buf_page_t;

struct buf_page_struct{
    /** @name General fields
    None of these bit-fields must be modified without holding
    buf_page_get_mutex() [buf_block_struct::mutex or
    buf_pool->zip_mutex], since they can be stored in the same
    machine word.  Some of these fields are additionally protected
    by buf_pool->mutex. */
    /* @{ */

    unsigned    space:32;    /*!< tablespace id; also protected
                    by buf_pool->mutex. */
    unsigned    offset:32;    /*!< page number; also protected
                    by buf_pool->mutex. */

    unsigned    state:BUF_PAGE_STATE_BITS;
                    /*!< state of the control block; also
                    protected by buf_pool->mutex.
                    State transitions from
                    BUF_BLOCK_READY_FOR_USE to
                    BUF_BLOCK_MEMORY need not be
                    protected by buf_page_get_mutex().
                    @see enum buf_page_state */
#ifndef UNIV_HOTBACKUP
    unsigned    flush_type:2;    /*!< if this block is currently being
                    flushed to disk, this tells the
                    flush_type.
                    @see enum buf_flush */
    unsigned    io_fix:2;    /*!< type of pending I/O operation;
                    also protected by buf_pool->mutex
                    @see enum buf_io_fix */
    unsigned    buf_fix_count:19;/*!< count of how manyfold this block
                    is currently bufferfixed */
    unsigned    buf_pool_index:6;/*!< index number of the buffer pool
                    that this block belongs to */
# if MAX_BUFFER_POOLS > 64
#  error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6"
# endif
    /* @} */
#endif /* !UNIV_HOTBACKUP */
    page_zip_des_t    zip;        /*!< compressed page; zip.data
                    (but not the data it points to) is
                    also protected by buf_pool->mutex;
                    state == BUF_BLOCK_ZIP_PAGE and
                    zip.data == NULL means an active
                    buf_pool->watch */
#ifndef UNIV_HOTBACKUP
    buf_page_t*    hash;        /*!< node used in chaining to
                    buf_pool->page_hash or
                    buf_pool->zip_hash */
#ifdef UNIV_DEBUG
    ibool        in_page_hash;    /*!< TRUE if in buf_pool->page_hash */
    ibool        in_zip_hash;    /*!< TRUE if in buf_pool->zip_hash */
#endif /* UNIV_DEBUG */

    /** @name Page flushing fields
    All these are protected by buf_pool->mutex. */
    /* @{ */

    UT_LIST_NODE_T(buf_page_t) list;
                    /*!< based on state, this is a
                    list node, protected either by
                    buf_pool->mutex or by
                    buf_pool->flush_list_mutex,
                    in one of the following lists in
                    buf_pool:

                    - BUF_BLOCK_NOT_USED:    free
                    - BUF_BLOCK_FILE_PAGE:    flush_list
                    - BUF_BLOCK_ZIP_DIRTY:    flush_list
                    - BUF_BLOCK_ZIP_PAGE:    zip_clean
                    - BUF_BLOCK_ZIP_FREE:    zip_free[]

                    If bpage is part of flush_list
                    then the node pointers are
                    covered by buf_pool->flush_list_mutex.
                    Otherwise these pointers are
                    protected by buf_pool->mutex.

                    The contents of the list node
                    is undefined if !in_flush_list
                    && state == BUF_BLOCK_FILE_PAGE,
                    or if state is one of
                    BUF_BLOCK_MEMORY,
                    BUF_BLOCK_REMOVE_HASH or
                    BUF_BLOCK_READY_IN_USE. */

#ifdef UNIV_DEBUG
    ibool        in_flush_list;    /*!< TRUE if in buf_pool->flush_list;
                    when buf_pool->flush_list_mutex is
                    free, the following should hold:
                    in_flush_list
                    == (state == BUF_BLOCK_FILE_PAGE
                        || state == BUF_BLOCK_ZIP_DIRTY)
                    Writes to this field must be
                    covered by both block->mutex
                    and buf_pool->flush_list_mutex. Hence
                    reads can happen while holding
                    any one of the two mutexes */
    ibool        in_free_list;    /*!< TRUE if in buf_pool->free; when
                    buf_pool->mutex is free, the following
                    should hold: in_free_list
                    == (state == BUF_BLOCK_NOT_USED) */
#endif /* UNIV_DEBUG */
    ib_uint64_t    newest_modification;
                    /*!< log sequence number of
                    the youngest modification to
                    this block, zero if not
                    modified. Protected by block
                    mutex */
    ib_uint64_t    oldest_modification;
                    /*!< log sequence number of
                    the START of the log entry
                    written of the oldest
                    modification to this block
                    which has not yet been flushed
                    on disk; zero if all
                    modifications are on disk.
                    Writes to this field must be
                    covered by both block->mutex
                    and buf_pool->flush_list_mutex. Hence
                    reads can happen while holding
                    any one of the two mutexes */
    /* @} */
    /** @name LRU replacement algorithm fields
    These fields are protected by buf_pool->mutex only (not
    buf_pool->zip_mutex or buf_block_struct::mutex). */
    /* @{ */

    UT_LIST_NODE_T(buf_page_t) LRU;
                    /*!< node of the LRU list */
#ifdef UNIV_DEBUG
    ibool        in_LRU_list;    /*!< TRUE if the page is in
                    the LRU list; used in
                    debugging */
#endif /* UNIV_DEBUG */
    unsigned    old:1;        /*!< TRUE if the block is in the old
                    blocks in buf_pool->LRU_old */
    unsigned    freed_page_clock:31;/*!< the value of
                    buf_pool->freed_page_clock
                    when this block was the last
                    time put to the head of the
                    LRU list; a thread is allowed
                    to read this for heuristic
                    purposes without holding any
                    mutex or latch */
    /* @} */
    unsigned    access_time;    /*!< time of first access, or
                    0 if the block was never accessed
                    in the buffer pool. Protected by
                    block mutex */
# if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
    ibool        file_page_was_freed;
                    /*!< this is set to TRUE when fsp
                    frees a page in buffer pool */
# endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */
};
时间: 2024-10-12 10:55:25

结构体buf_page_t的相关文章

关于结构体

1.结构体(struct)是由一系列具有相同类型或不同类型的数据构成的数据集合,叫做结构. typedef struct People { int a; char b; double c; }P: 其中:struct是关键词, People是标签, a b c是成员, P是此结构体声明的变量. 于是在声明变量的时候就可:P p1; 这里的P实际上就是struct People的别名.P==struct People 另外这里也可以不写People(于是也不能struct People p1;了,

Linux C中结构体初始化

    在阅读GNU/Linux内核代码时,我们会遇到一种特殊的结构初始化方式.该方式是某些C教材(如谭二版.K&R二版)中没有介绍过的.这种方式称为指定初始化(designated initializer).下面我们看一个例子,Linux-2.6.x/drivers/usb/storage/usb.c中有这样一个结构体初始化项目: static struct usb_driver usb_storage_driver = { .owner = THIS_MODULE, .name = "

在Swift结构体中如何实现写时复制?

结构体(Struct)在Swift语言中占有重要地位,在Swift标准库中,大约有90%的公开类型都是结构体,包括我们常用的Array.String.Dictionary.结构体相比类,一个最重要的特性就是它是值类型,而类似引用类型.值类型是通过复制值来赋值的,而不是引用同一个内存地址,这样就不存在数据共享的问题,能防止意外的数据改变,并且它是线程安全的. 举一个很简单的例子,在objc中,数组是类,是引用类型,在Swift中,数组是结构体,是值类型.因此下面的代码中: let array1 =

结构体的大小

系统在存储结构体变量时存在地址对齐问题,编译器在编译程序时会遵循两条原则: 一.结构体变量中成员的偏移量必须是成员大小的整数倍: 二.结构体大小必须是所有成员大小的整数倍. 1 #include<stdio.h> 2 3 struct a{ 4 int i; 5 float f; 6 char c; 7 double d; 8 long l; 9 }b; 10 11 int main(){ 12 printf("%d\n",sizeof(b.i));// 4 13 prin

关于OC中直接打印结构体,点(CGRect,CGSize,CGPoint,UIOffset)等数据类型

关于OC直接打印结构体,点(CGRect,CGSize,CGPoint,UIOffset)等数据类型,我们完全可以把其转换为OC对象来进项打印调试,而不必对结构体中的成员变量进行打印.就好比我们可以使用NSStringFromCGRect(CGRect rect)来直接打印一个结构体,其他打印可以参考以下内容 UIKIT_EXTERN NSString *NSStringFromCGPoint(CGPoint point); UIKIT_EXTERN NSString *NSStringFrom

38-oc常用结构体

常用结构体 在开发中苹果推荐我们使用CG开头的结构体, 也就是说NS开头的结构体一般不用 OC中定义一个点,用什么结构体 NSPoint; CGPoint point = NSMakePoint(10, 20); OC中保存物体尺寸的,用什么结构体 NSSize; CGSize size = NSMakeSize(100, 50); OC中保存某个物体的位置和尺寸,用什么结构体 NSRect; CGRect rect = NSMakeRect(10, 20, 100, 50); NSNumber

结构体在固件库中的应用

上次介绍了一般结构体的定义以及引用方法,那么接下来将对结构体在官方固件库是如何具体使用的做出简单说明. 结构体指针成员变量引用方法是通过“→”符号来实现,比如要访问student1结构体指针指向的结构体的成员变量name,那么方法是: stuednt1—>name; 如在STM32官方固件库中对端口使用模式结构体定义如下: typedef enum { GPIO_Mode_AIN = 0x0, //模拟输入模式 GPIO_Mode_IN_FLOATING = 0x04, //浮空输入模式 GPI

C# 定义一个学生的结构体,输入学生信息,学号,姓名,身高,按身高排序输出

class Program { //定义一个结构体 struct student//student就是我们自己造的新数据类型 { public int code;//public修饰符 public string name;//结构体的成员 public decimal height; } static void Main(string[] args) { ArrayList arr = new ArrayList(); for (int i = 0; i < 3; i++) { student

类和结构体

//类  class A {     var a = 0 } let classA = A() classA.a = 12     //虽然classA定义为常量,但是仍然可以修改A类中的变量值;结构体则不可以 //类属于引用类型,结构体属于值类型