Chinaunix首页 | 论坛 | 博客
  • 博客访问: 291174
  • 博文数量: 49
  • 博客积分: 3083
  • 博客等级: 中校
  • 技术积分: 710
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-27 08:22
文章分类

全部博文(49)

文章存档

2009年(8)

2008年(41)

分类:

2008-09-08 11:32:07

/*
*Linux页高速缓存实用化address_space结构体描述页高速缓存中的页面
*定义文件在linux/fs.h中
*/



struct address_space {
        struct inode            *host;              /* 拥有节点 */
        struct radix_tree_root  page_tree;          /* 包含全部页面的radix树 */
        spinlock_t              tree_lock;          /* 保护page_tree的自旋锁 */
        unsigned int            i_mmap_writable;    /* VM_SHARED记数 */
        struct prio_tree_root   i_mmap;             /* 似有映射链表 */
        struct list_head        i_mmap_nonlinear;   /* VM_NONLINEAR链表 */
        spinlock_t              i_mmap_lock;        /* 保护i_mmap的自旋锁 */
        atomic_t                truncate_count;     /* 截断记数 */
        unsigned long           nrpages;            /* 页总数 */
        pgoff_t                 writeback_index;    /* 回写的起始偏移 */
        struct address_space_operations   *a_ops;   /* 操作表 */
        unsigned long           flags;              /* gfp_mask掩码与错误标识 */
        struct backing_dev_info *backing_dev_info;  /* 预读信息 */
        spinlock_t              private_lock;       /* 私有address_space锁 */
        struct list_head        private_list;       /* 私有address_space链表 */
        struct address_space    *assoc_mapping;     /* 相关的缓冲 */
};

/*
*a_ops域指向地址空间对象中的操作函数表,操作函数表定义在文件linux/fs.h中
*由address_space_operations 结构体来表示
*/
struct address_space_operations {
        int (*writepage)(struct page *, struct writeback_control *);
        int (*readpage) (struct file *, struct page *);
        int (*sync_page) (struct page *);
        int (*writepages) (struct address_space *, struct writeback_control *);
        int (*set_page_dirty) (struct page *);
        int (*readpages) (struct file *, struct address_space *,
                          struct list_head *, unsigned);
        int (*prepare_write) (struct file *, struct page *, unsigned, unsigned);
        int (*commit_write) (struct file *, struct page *, unsigned, unsigned);
        sector_t (*bmap)(struct address_space *, sector_t);
        int (*invalidatepage) (struct page *, unsigned long);
        int (*releasepage) (struct page *, int);
        int (*direct_IO) (int, struct kiocb *, const struct iovec *,
                          loff_t, unsigned long);
};

阅读(1081) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~