此结构包含关于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]
/* 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]