Chinaunix首页 | 论坛 | 博客
  • 博客访问: 76404
  • 博文数量: 172
  • 博客积分: 2047
  • 博客等级: 大尉
  • 技术积分: 1745
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-19 15:23
文章分类

全部博文(172)

文章存档

2011年(72)

2010年(100)

我的朋友

分类: LINUX

2010-05-20 10:17:15


struct dentry {
    atomic_t d_count;
    unsigned int d_flags;        /* protected by d_lock */
    spinlock_t d_lock;        /* per dentry lock */
    int d_mounted;
    struct inode *d_inode;        /* Where the name belongs to - NULL is
                     * negative */

    /*
     * The next three fields are touched by __d_lookup. Place them here
     * so they all fit in a cache line.
     */

    struct hlist_node d_hash;    /* lookup hash list */
    struct dentry *d_parent;    /* parent directory */
    struct qstr d_name;

    struct list_head d_lru;        /* LRU list */
    /*
     * d_child and d_rcu can share memory
     */

    union {
        struct list_head d_child;    /* child of parent list */
         struct rcu_head d_rcu;
    } d_u;
    struct list_head d_subdirs;    /* our children */
    struct list_head d_alias;    /* inode alias list */
    unsigned long d_time;        /* used by d_revalidate */
    const struct dentry_operations *d_op;
    struct super_block *d_sb;    /* The root of the dentry tree */
    void *d_fsdata;            /* fs-specific data */

    unsigned char d_iname[DNAME_INLINE_LEN_MIN];    /* small names */
};




struct dentry_operations {
    int (*d_revalidate)(struct dentry *, struct nameidata *);
    int (*d_hash) (struct dentry *, struct qstr *);
    int (*d_compare) (struct dentry *, struct qstr *, struct qstr *);
    int (*d_delete)(struct dentry *);
    void (*d_release)(struct dentry *);
    void (*d_iput)(struct dentry *, struct inode *);
    char *(*d_dname)(struct dentry *, char *, int);
};

/* the dentry parameter passed to d_hash and d_compare is the parent
 * directory of the entries to be compared. It is used in case these
 * functions need any directory specific information for determining
 * equivalency classes. Using the dentry itself might not work, as it
 * might be a negative dentry which has no information associated with
 * it */


/*
locking rules:
        big lock    dcache_lock    d_lock may block
d_revalidate:    no        no        no yes
d_hash        no        no        no yes
d_compare:    no        yes        yes no
d_delete:    no        yes        no no
d_release:    no        no        no yes
d_iput:        no        no        no yes
 */


阅读(1316) | 评论(0) | 转发(0) |
0

上一篇:vfs lock

下一篇:随记

给主人留下些什么吧!~~