Search notes:

include/linux/dcache.h

Dirent cache data structures

dentry

Definition of a dentry, as of Linux version 5.18
struct dentry { #linx-dentry
  /* RCU lookup touched fields */
  unsigned int                    d_flags;                    /* protected by d_lock */
  seqcount_spinlock_t             d_seq;                      /* per dentry seqlock */
  struct hlist_bl_node            d_hash;                     /* lookup hash list */
  struct dentry                  *d_parent;                   /* parent directory */
  struct qstr                     d_name;
  struct inode                   *d_inode;                    /* Where the name belongs to - NULL is * negative */
  unsigned char                   d_iname[DNAME_INLINE_LEN];  /* small names */

  /* Ref lookup also touches following */
  struct lockref                  d_lockref;                  /* per-dentry lock and refcount */
  const struct dentry_operations *d_op;
  struct super_block             *d_sb;                       /* The root of the dentry tree */
  unsigned long                   d_time;                     /* used by d_revalidate */
  void                           *d_fsdata;                   /* fs-specific data */

  union {
    struct list_head              d_lru;                      /* LRU list */
    wait_queue_head_t            *d_wait;                     /* in-lookup ones only */
  };
  struct list_head                d_child;                    /* child of parent list */
  struct list_head                d_subdirs;                  /* our children */
  /*
   * d_alias and d_rcu can share memory
   */
  union {
    struct hlist_node             d_alias;                    /* inode alias list */
    struct hlist_bl_node          d_in_lookup_hash;           /* only for in-lookup ones */
    struct rcu_head               d_rcu;
  } d_u;
} __randomize_layout;
Compare with the dirent struct of the standard C library (found in <dirent.h>).

dentry_operations

As of Linux version 5.18
struct dentry_operations {
  int               (*d_revalidate     )(      struct dentry *, unsigned int);
  int               (*d_weak_revalidate)(      struct dentry *, unsigned int);
  int               (*d_hash           )(const struct dentry *, struct qstr *);
  int               (*d_compare        )(const struct dentry *, unsigned int, const char *, const struct qstr *);
  int               (*d_delete         )(const struct dentry *);
  int               (*d_init           )(      struct dentry *);
  void              (*d_release        )(      struct dentry *);
  void              (*d_prune          )(      struct dentry *);
  void              (*d_iput           )(      struct dentry *, struct inode *);
  char             *(*d_dname          )(      struct dentry *, char *, int);
  struct vfsmount  *(*d_automount      )(      struct path   *);
  int               (*d_manage         )(const struct path   *, bool);
  struct dentry    *(*d_real           )(      struct dentry *, const struct inode *);
} ____cacheline_aligned;

Links

https://github.com/torvalds/linux/blob/master/include/linux/dcache.h

Index