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 <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
Andrew Deason 2022-10-25 14:00:52 -05:00
parent 1435b686a9
commit bc55f8a99b
5 changed files with 18 additions and 11 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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 */