git: 811f6a0ae023 - main - VFS cache: Fix initial sizing for non-default 'ncsizefactor'

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Tue, 06 May 2025 13:01:18 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=811f6a0ae0230fb09b666276cbe93a8be4fe7c73

commit 811f6a0ae0230fb09b666276cbe93a8be4fe7c73
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-05-01 10:30:49 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-05-06 13:00:00 +0000

    VFS cache: Fix initial sizing for non-default 'ncsizefactor'
    
    Reviewed by:    markj
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D50120
---
 sys/kern/vfs_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index c949363de003..9089c0fd78b4 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -2772,7 +2772,7 @@ nchinit(void *dummy __unused)
 
 	ncsize = desiredvnodes * ncsizefactor;
 	cache_recalc_neg_min();
-	nchashtbl = nchinittbl(desiredvnodes * 2, &nchash);
+	nchashtbl = nchinittbl(ncsize, &nchash);
 	ncbuckethash = cache_roundup_2(mp_ncpus * mp_ncpus) - 1;
 	if (ncbuckethash < 7) /* arbitrarily chosen to avoid having one lock */
 		ncbuckethash = 7;