Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Mar 2022 01:52:42 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9af41803cbe5 - main - Use vnsz2log directly in assertion on its relation to sizeof(struct vnode).
Message-ID:  <202203040152.2241qgOV027956@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203040152.2241qgOV027956>