1、page
结构体struct page定义在/include/linux/mm_types.h。page描述的是一片实际物理内存信息,一般是4K大小,简称页。在page中保存有状态信息,和文件系统,内存交换等方面的信息,唯独没有保存物理内存的偏移,即其代表4K是物理内存什么位置的4K。
这个信息实际是被隐式保存起来了,因为所有的struct page结构体都共同保存在同一个mem_map数组里面,数组下标实际就是物理内存位置。因此page就代表了内存。
2、Buffer Head
Buffer Head的结构体定义在/include/linux/buffer_head.h。一般不容易理解其作用,代码上也经常和page混在一起。它其实表针的不是内存,虽然名称里面有buffer字眼。它实际代表的是物理内存映射的块设备偏移位置。
struct buffer_head {
unsigned long b_state; /* buffer state bitmap (see above) */
struct buffer_head *b_this_page;/* circular list of page's buffers */
struct page *b_page; /* the page this bh is mapped to */
sector_t b_blocknr; /* start block number */
size_t b_size; /* size of mapping */
char *b_data; /* pointer to data within the page */
struct block_device *b_bdev;
bh_end_io_t *b_end_io; /* I/O completion */
void *b_private; /* reserved for b_end_io */
struct list_head b_assoc_buffers; /* associated with another mapping */
struct address_space *b_assoc_map; /* mapping this buffer is
associated with */
atomic_t b_count; /* users using this buffer_head */
};
举个简单例子,从块设备/dev/block/sda的第