1.目的
用户与磁盘进行文件交互时的流程
磁盘与高速缓冲区的关系
加深块设备驱动的理解
hash 循环链表 单链表的使用方法
2.高速缓冲区的工作流程
高速缓冲区中存储这对应的块设备驱动的数据
当从块设备中读取数据的时候,OS首先会从高速缓冲区中进行检索,如果没有则从块设备中读出数据,如果有且为最新的,就直接和该高速缓冲区进行数据交互。
buffer.c
高速缓冲区中有缓冲区低区和高区
低区和高区中的缓冲块一一对应
缓冲区的描述头-------高速缓冲区
高速缓冲区的头是?
高速缓冲区的头是一个结构体,里面存着高速缓冲区所有的状态 时间 信息
struct buffer_head {
	char * b_data;			/* pointer to data block (1024 bytes) */ 数据区 1k
	unsigned long b_blocknr;	/* block number */        数据逻辑块号 1k
	unsigned short b_dev;		/* device (0 = free) */    块设备号
	unsigned char b_uptodate;
	unsigned char b_dirt;		/* 0-clean,1-dirty */
	unsigned char b_count;		/* users using this block */
	unsigned char b_lock;		/* 0 - ok, 1 -locked */
	struct task_struct * b_wait;
	struct buffer_head * b_prev;
	struct buffer_head * b_next;
	struct buffer_head * b_prev_free;
	struct buffer_head * b_next_free;
}; 

 
 















](https://img-blog.csdnimg.cn/img_convert/cfb68c87c97daaecc89dda2a9d3cfcc9.png)



