aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2023-09-14 16:13:01 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2023-10-10 12:49:04 +0000
commit8733bc277a383cf59f38a83956f4f523869cfc90 (patch)
tree1e42341ce4141b9eac57eadcee652211fe0fa911 /sys/kern/vfs_subr.c
parentb627b3e6ea0d806b2c54dd1654cab310825ae147 (diff)
downloadsrc-8733bc277a383cf59f38a83956f4f523869cfc90.tar.gz
src-8733bc277a383cf59f38a83956f4f523869cfc90.zip
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 0251525a50c7..e37f8697efa2 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1802,11 +1802,19 @@ vn_alloc_hard(struct mount *mp)
mtx_unlock(&vnode_list_mtx);
goto alloc;
}
- rfreevnodes = vnlru_read_freevnodes();
- if (vn_alloc_cyclecount++ >= rfreevnodes) {
- vn_alloc_cyclecount = 0;
- vstir = true;
+
+ if (vn_alloc_cyclecount != 0) {
+ rfreevnodes = vnlru_read_freevnodes();
+ if (rfreevnodes < wantfreevnodes) {
+ if (vn_alloc_cyclecount++ >= rfreevnodes) {
+ vn_alloc_cyclecount = 0;
+ vstir = true;
+ }
+ } else {
+ vn_alloc_cyclecount = 0;
+ }
}
+
/*
* Grow the vnode cache if it will not be above its target max
* after growing. Otherwise, if the free list is nonempty, try