git: 9af41803cbe5 - main - Use vnsz2log directly in assertion on its relation to sizeof(struct vnode).

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 04 Mar 2022 01:52:42 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=9af41803cbe5cf88e145e44cc28d8db2642a0e90

commit 9af41803cbe5cf88e145e44cc28d8db2642a0e90
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-03-04 01:52:07 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-03-04 01:52:07 +0000

    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 56efe0367c03..afafd02d92b9 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