* Name cache initialization, from vfs_init() when we are booting */
| 2515 | * Name cache initialization, from vfs_init() when we are booting |
| 2516 | */ |
| 2517 | static void |
| 2518 | nchinit(void *dummy __unused) |
| 2519 | { |
| 2520 | u_int i; |
| 2521 | |
| 2522 | cache_zone_small = uma_zcreate("S VFS Cache", CACHE_ZONE_SMALL_SIZE, |
| 2523 | NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); |
| 2524 | cache_zone_small_ts = uma_zcreate("STS VFS Cache", CACHE_ZONE_SMALL_TS_SIZE, |
| 2525 | NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); |
| 2526 | cache_zone_large = uma_zcreate("L VFS Cache", CACHE_ZONE_LARGE_SIZE, |
| 2527 | NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); |
| 2528 | cache_zone_large_ts = uma_zcreate("LTS VFS Cache", CACHE_ZONE_LARGE_TS_SIZE, |
| 2529 | NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); |
| 2530 | |
| 2531 | VFS_SMR_ZONE_SET(cache_zone_small); |
| 2532 | VFS_SMR_ZONE_SET(cache_zone_small_ts); |
| 2533 | VFS_SMR_ZONE_SET(cache_zone_large); |
| 2534 | VFS_SMR_ZONE_SET(cache_zone_large_ts); |
| 2535 | |
| 2536 | ncsize = desiredvnodes * ncsizefactor; |
| 2537 | cache_recalc_neg_min(ncnegminpct); |
| 2538 | nchashtbl = nchinittbl(desiredvnodes * 2, &nchash); |
| 2539 | ncbuckethash = cache_roundup_2(mp_ncpus * mp_ncpus) - 1; |
| 2540 | if (ncbuckethash < 7) /* arbitrarily chosen to avoid having one lock */ |
| 2541 | ncbuckethash = 7; |
| 2542 | if (ncbuckethash > nchash) |
| 2543 | ncbuckethash = nchash; |
| 2544 | bucketlocks = malloc(sizeof(*bucketlocks) * numbucketlocks, M_VFSCACHE, |
| 2545 | M_WAITOK | M_ZERO); |
| 2546 | for (i = 0; i < numbucketlocks; i++) |
| 2547 | mtx_init(&bucketlocks[i], "ncbuc", NULL, MTX_DUPOK | MTX_RECURSE); |
| 2548 | ncvnodehash = ncbuckethash; |
| 2549 | vnodelocks = malloc(sizeof(*vnodelocks) * numvnodelocks, M_VFSCACHE, |
| 2550 | M_WAITOK | M_ZERO); |
| 2551 | for (i = 0; i < numvnodelocks; i++) |
| 2552 | mtx_init(&vnodelocks[i], "ncvn", NULL, MTX_DUPOK | MTX_RECURSE); |
| 2553 | |
| 2554 | for (i = 0; i < numneglists; i++) { |
| 2555 | mtx_init(&neglists[i].nl_evict_lock, "ncnege", NULL, MTX_DEF); |
| 2556 | mtx_init(&neglists[i].nl_lock, "ncnegl", NULL, MTX_DEF); |
| 2557 | TAILQ_INIT(&neglists[i].nl_list); |
| 2558 | TAILQ_INIT(&neglists[i].nl_hotlist); |
| 2559 | } |
| 2560 | } |
| 2561 | SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_SECOND, nchinit, NULL); |
| 2562 | |
| 2563 | void |
nothing calls this directly
no test coverage detected