void buffer_init(long buffer_end)函数的理解:
* 0 0x100000 0x400000 0x10 00000(16M)
* ----------------------------------------------------------
* | kernel | memery buffer | main memory |
* ----------------------------------------------------------
以上图为例,该段主要初始化memery buffer部分,并且前地址地段储存缓存头部,高端储存缓存块(1K);
缓存头部struct buffer_head
1 struct buffer_head { 2 char * b_data; /* pointer to data block (1024 bytes) */ 3 unsigned long b_blocknr; /* block number */ 4 unsigned short b_dev; /* device (0 = free) */ 5 unsigned char b_uptodate; 6 unsigned char b_dirt; /* 0-clean,1-dirty */ 7 unsigned char b_count; /* users using this block */ 8 unsigned char b_lock; /* 0 - ok, 1 -locked */ 9 struct task_struct * b_wait; 10 struct buffer_head * b_prev; 11 struct buffer_head * b_next; 12 struct buffer_head * b_prev_free; 13 struct buffer_head * b_next_free; 14 };
用环形双链表链接:
node0 <--->node1<--> ...... <-->noden<-->node0
原文:http://www.cnblogs.com/qianzhilan/p/6091644.html