ILD

dentry state
作者:Yuan Jianpeng 邮箱:yuanjp89@163.com
发布时间:2026-4-22 站点:Inside Linux Development

struct dentry_stat定义在linux/include/linux/dcache.h,包含了dentry的一些信息。


struct dentry_stat_t dentry_stat {

      int nr_dentry;

      int nr_unused;

      int age_limit;         /* age in seconds */

      int want_pages;        /* pages requested by system */

      int nr_negative;       /* # of unused negative dentries */

      int dummy;             /* Reserved for future use */

};


nr_dentry shows the total number of dentries allocated (active + unused). 

nr_unused shows the number of dentries that are not actively used, but are saved in the LRU list for future reuse.


age_limit is the age in seconds after which dcache entries can be reclaimed when memory is short and 

want_pages is nonzero when shrink_dcache_pages() has been called and the dcache isn't pruned yet.


nr_negative shows the number of unused dentries that are also negative dentries which do not map to any files. 

Instead, they help speeding up rejection of non-existing files provided by the users.


# cat /proc/sys/fs/dentry-state

8379    7523    45      0       1       0


Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.