cache: count vnodes in cache_purgevfs

(cherry picked from commit a2cb65b8fe)
This commit is contained in:
Mateusz Guzik 2021-09-18 10:30:15 +02:00
parent e1df0f5dbf
commit 93b14ce63d

View File

@ -237,7 +237,7 @@ SDT_PROBE_DEFINE2(vfs, namecache, removecnp, hit, "struct vnode *",
"struct componentname *");
SDT_PROBE_DEFINE2(vfs, namecache, removecnp, miss, "struct vnode *",
"struct componentname *");
SDT_PROBE_DEFINE1(vfs, namecache, purge, done, "struct vnode *");
SDT_PROBE_DEFINE3(vfs, namecache, purge, done, "struct vnode *", "size_t", "size_t");
SDT_PROBE_DEFINE1(vfs, namecache, purge, batch, "int");
SDT_PROBE_DEFINE1(vfs, namecache, purge_negative, done, "struct vnode *");
SDT_PROBE_DEFINE1(vfs, namecache, purgevfs, done, "struct mount *");
@ -3014,13 +3014,15 @@ void
cache_purgevfs(struct mount *mp)
{
struct vnode *vp, *mvp;
size_t visited, purged;
SDT_PROBE1(vfs, namecache, purgevfs, done, mp);
visited = purged = 0;
/*
* Somewhat wasteful iteration over all vnodes. Would be better to
* support filtering and avoid the interlock to begin with.
*/
MNT_VNODE_FOREACH_ALL(vp, mp, mvp) {
visited++;
if (!cache_has_entries(vp)) {
VI_UNLOCK(vp);
continue;
@ -3028,8 +3030,11 @@ cache_purgevfs(struct mount *mp)
vholdl(vp);
VI_UNLOCK(vp);
cache_purge(vp);
purged++;
vdrop(vp);
}
SDT_PROBE3(vfs, namecache, purgevfs, done, mp, visited, purged);
}
/*