函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:fs\dcache.c Create Date:2022-07-29 10:37:24
首页 Copyright©Brick

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS)
 
/*
 * Here we resort to our own counters instead of using generic per-cpu counters
 * for consistency with what the vfs inode code does. We are expected to harvest
 * better code and performance by having our own specialized counters.
 *
 * Please note that the loop is done over all possible CPUs, not over all online
 * CPUs. The reason for this is that we don't want to play games with CPUs going
 * on and off. If one of them goes off, we will just keep their counters.
 *
 * glommer: See cffbc8a for details, and if you ever intend to change this,
 * please update all vfs counters to match.
 */
static long get_nr_dentry(void)
{
    int i;
    long sum = 0;
    for_each_possible_cpu(i)
        sum += per_cpu(nr_dentry, i);
    return sum < 0 ? 0 : sum;
}