Linux核心数据结构--buffer_head

此结构包含关于buffer cache中一块缓存的信息。

/* bh state bits */

[b]#define BH_Uptodate 0 [/b] /* 1 if the buffer contains valid data */

[b]#define BH_Dirty 1 [/b] /* 1 if the buffer is dirty */

[b]#define BH_Lock 2 [/b] /* 1 if the buffer is locked */

[b]#define BH_Req 3 [/b] /* 0 if the buffer has been invalidated */

[b]#define BH_Touched 4[/b] /* 1 if the buffer has been touched (aging) */

[b]#define BH_Has_aged 5 [/b] /* 1 if the buffer has been aged (aging) */

[b]#define BH_Protected 6 [/b] /* 1 if the buffer is protected */
[b]
#define BH_FreeOnIO 7[/b] /* 1 to discard the buffer_head after IO */


[b]struct buffer_head {[/b]

/* First cache line: */

[b] unsigned long b_blocknr; [/b] /* block number */

[b] kdev_t b_dev; [/b] /* device (B_FREE = free) */

[b] kdev_t b_rdev; [/b] /* Real device */

[b]unsigned long b_rsector;[/b] /* Real buffer location on disk */

[b]struct buffer_head *b_next; [/b] /* Hash queue list */

[b] struct buffer_head *b_this_page;[/b] /* circular list of buffers in one

page */


/* Second cache line: */

[b] unsigned long b_state; [/b] /* buffer state bitmap (above) */

[b]struct buffer_head *b_next_free;[/b]

[b]unsigned int b_count; [/b] /* users using this block */

[b]unsigned long b_size; [/b] /* block size */


/* Non-performance-critical data follows. */

[b] char *b_data; [/b] /* pointer to data block */

[b]unsigned int b_list; [/b] /* List that this buffer appears */

[b]unsigned long b_flushtime;[/b] /* Time when this (dirty) buffer

* should be written */

[b] unsigned long b_lru_time;[/b] /* Time when this buffer was

* last used. */

[b]struct wait_queue *b_wait;[/b]

[b]struct buffer_head *b_prev; [/b] /* doubly linked hash list */

[b]struct buffer_head *b_prev_free;[/b] /* doubly linked list of buffers */

[b]struct buffer_head *b_reqnext; [/b] /* request queue */

[b]};[/b]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值