From bc55f8a99bf085cdaad859e763aeb9ac222fc510 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 25 Oct 2022 14:00:52 -0500 Subject: [PATCH] FBSD: Use VN_IS_DOOMED when available FreeBSD commit abd80ddb9474948fb291becc395d72b40927a32b (vfs: introduce v_irflag and make v_type smaller) removed the VI_DOOMED flag, moving the flag to a different field and name. Use the new VN_IS_DOOMED() macro instead. Change-Id: I6f064f3313d28abee34481a499cd69890f151f91 Reviewed-on: https://gerrit.openafs.org/15163 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason --- src/afs/FBSD/osi_vcache.c | 6 +++--- src/afs/FBSD/osi_vm.c | 2 +- src/afs/FBSD/osi_vnodeops.c | 12 ++++++------ src/afs/VNOPS/afs_vnop_write.c | 2 +- src/config/param.generic_fbsd.h | 7 +++++++ 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/afs/FBSD/osi_vcache.c b/src/afs/FBSD/osi_vcache.c index 7b5888eb30..94f2008a0b 100644 --- a/src/afs/FBSD/osi_vcache.c +++ b/src/afs/FBSD/osi_vcache.c @@ -36,7 +36,7 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) return evicted; } - if ((vp->v_iflag & VI_DOOMED) != 0) { + if (AFS_IS_DOOMED(vp)) { VI_UNLOCK(vp); evicted = 1; return evicted; @@ -139,7 +139,7 @@ osi_vnhold(struct vcache *avc) struct vnode *vp = AFSTOV(avc); VI_LOCK(vp); - if ((vp->v_iflag & VI_DOOMED) != 0) { + if (AFS_IS_DOOMED(vp)) { VI_UNLOCK(vp); return ENOENT; } @@ -157,7 +157,7 @@ osi_vnhold(struct vcache *avc) vref(vp); VI_LOCK(vp); - if ((vp->v_iflag & VI_DOOMED) != 0) { + if (AFS_IS_DOOMED(vp)) { VI_UNLOCK(vp); vrele(vp); return ENOENT; diff --git a/src/afs/FBSD/osi_vm.c b/src/afs/FBSD/osi_vm.c index f0c43ab667..fa020599f6 100644 --- a/src/afs/FBSD/osi_vm.c +++ b/src/afs/FBSD/osi_vm.c @@ -162,7 +162,7 @@ osi_VM_TryToSmush(struct vcache *avc, afs_ucred_t *acred, int sync) vp = AFSTOV(avc); VI_LOCK(vp); - if (vp->v_iflag & VI_DOOMED) { + if (AFS_IS_DOOMED(vp)) { VI_UNLOCK(vp); return; } diff --git a/src/afs/FBSD/osi_vnodeops.c b/src/afs/FBSD/osi_vnodeops.c index 3f9788939f..bd888fd75f 100644 --- a/src/afs/FBSD/osi_vnodeops.c +++ b/src/afs/FBSD/osi_vnodeops.c @@ -364,14 +364,14 @@ afs_vop_close(ap) * struct thread *a_td; * } */ *ap; { - int code, iflag; + int code, doomed; struct vnode *vp = ap->a_vp; struct vcache *avc = VTOAFS(vp); VI_LOCK(vp); - iflag = vp->v_iflag & VI_DOOMED; + doomed = AFS_IS_DOOMED(vp); VI_UNLOCK(vp); - if (iflag & VI_DOOMED) { + if (doomed) { /* osi_FlushVCache (correctly) calls vgone() on recycled vnodes, we don't * have an afs_close to process, in that case */ if (avc->opens != 0) @@ -1197,9 +1197,9 @@ afs_vop_reclaim(struct vop_reclaim_args *ap) /* * Note that we deliberately call VOP_LOCK() instead of vn_lock() here. - * vn_lock() will return an error for VI_DOOMED vnodes, but we know this - * vnode is already VI_DOOMED. We just want to lock it again, and skip the - * VI_DOOMED check. + * vn_lock() will return an error for VN_IS_DOOMED() vnodes, but we know + * this vnode is already VN_IS_DOOMED(). We just want to lock it again, and + * skip the VN_IS_DOOMED() check. */ AFS_GUNLOCK(); VOP_LOCK(vp, LK_EXCLUSIVE); diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index 60d9553897..95a5348774 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -627,7 +627,7 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, afs_ucred_t *acred) afs_int32 opens, is_free, is_gone, is_doomed, iflag; struct vnode *vp = AFSTOV(avc); VI_LOCK(vp); - is_doomed = vp->v_iflag & VI_DOOMED; + is_doomed = AFS_IS_DOOMED(vp); is_free = vp->v_iflag & VI_FREE; is_gone = vp->v_iflag & VI_DOINGINACT; iflag = vp->v_iflag; diff --git a/src/config/param.generic_fbsd.h b/src/config/param.generic_fbsd.h index e74e84ffb7..003d93933c 100644 --- a/src/config/param.generic_fbsd.h +++ b/src/config/param.generic_fbsd.h @@ -128,6 +128,13 @@ enum vcexcl { NONEXCL, EXCL }; # define AFS_FBSD_NET_FOREACH TAILQ_FOREACH #endif +/* r355537 removed VI_DOOMED, use VN_IS_DOOMED instead */ +#if __FreeBSD_version >= 1300064 +# define AFS_IS_DOOMED(vp) VN_IS_DOOMED(vp) +#else +# define AFS_IS_DOOMED(vp) (((vp)->v_iflag & VI_DOOMED) != 0) +#endif + #else /* !defined(UKERNEL) */ /* This section for user space compiles only */