页高速缓存的结构体
页高速缓存可以缓存任何基于页的对象,包含各种类型的文件和各种类型的内存映射。
address_space
为维持页高速缓存的普遍性,不应该将其绑定到物理文件或者inode结构体,linux使用了一个新对象管理缓存项和页I/O操作------address_space结构体。该结构体是vm_area_struct虚拟地址的物理地址对等体。文件可以有多个虚拟地址,但物理内存只有一份,只能有一个address_space数据结构。
struct address_space {
struct inode *host; /* owner: inode, block_device */
struct radix_tree_root page_tree; /* radix tree of all pages */
spinlock_t tree_lock; /* and spinlock protecting it */
unsigned int i_mmap_writable;/* count VM_SHARED mappings */
struct prio_tree_root i_mmap; /* tree of private and shared mappings */
struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
spinlock_t i_mmap_lock; /* protect tree, count, list */