From 9af41803cbe5cf88e145e44cc28d8db2642a0e90 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 3 Mar 2022 17:52:07 -0800 Subject: [PATCH] Use vnsz2log directly in assertion on its relation to sizeof(struct vnode). This reduces the size of diffs required to support different values of vnsz2log. In CheriBSD, kernels for CHERI architectures have vnodes larger than 512 bytes and require a value of 9. Reviewed by: mjg Obtained from: CheriBSD Sponsored by: University of Cambridge, Google, Inc. Differential Revision: https://reviews.freebsd.org/D34418 --- sys/kern/vfs_subr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 56efe0367c0..afafd02d92b 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -462,7 +462,8 @@ SYSCTL_PROC(_debug, OID_AUTO, ftry_reclaim_vnode, /* Shift count for (uintptr_t)vp to initialize vp->v_hash. */ #define vnsz2log 8 #ifndef DEBUG_LOCKS -_Static_assert((sizeof(struct vnode) >= 256) && (sizeof(struct vnode) < 512), +_Static_assert(sizeof(struct vnode) >= 1UL << vnsz2log && + sizeof(struct vnode) < 1UL << (vnsz2log + 1), "vnsz2log needs to be updated"); #endif