From ccd5cb381e026169ee4488b95cbf375f00b7dd39 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 25 Oct 2022 14:05:48 -0500 Subject: [PATCH] FBSD: Use vm_object_mightbedirty when available FreeBSD commit 67d0e29304805e43b17e5c27e5a6c566d800a24c (Replace OBJ_MIGHTBEDIRTY with a system using atomics...) removed the OBJ_MIGHTBEDIRTY flag, effectively replacing it with the vm_object_mightbedirty() function. Use the new function. Change-Id: Ic4dd47896dd60e4371ffba65648bc6c2e94c1542 Reviewed-on: https://gerrit.openafs.org/15162 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason --- src/afs/FBSD/osi_vm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/afs/FBSD/osi_vm.c b/src/afs/FBSD/osi_vm.c index d02c533f88..f0c43ab667 100644 --- a/src/afs/FBSD/osi_vm.c +++ b/src/afs/FBSD/osi_vm.c @@ -61,6 +61,13 @@ #define AFS_VM_OBJECT_WUNLOCK(o) VM_OBJECT_UNLOCK(o) #endif +/* r354158 removed OBJ_MIGHTBEDIRTY, use vm_object_mightbedirty instead */ +#if __FreeBSD_version >= 1300054 +# define AFS_VM_OBJECT_MIGHTBEDIRTY(o) vm_object_mightbedirty(o) +#else +# define AFS_VM_OBJECT_MIGHTBEDIRTY(o) (((o)->flags & OBJ_MIGHTBEDIRTY) != 0) +#endif + /* Try to discard pages, in order to recycle a vcache entry. * * We also make some sanity checks: ref count, open count, held locks. @@ -123,7 +130,7 @@ osi_VM_StoreAllSegments(struct vcache *avc) obj = vp->v_object; - if (obj != NULL && (obj->flags & OBJ_MIGHTBEDIRTY) != 0) { + if (obj != NULL && AFS_VM_OBJECT_MIGHTBEDIRTY(obj)) { ReleaseWriteLock(&avc->lock); AFS_GUNLOCK();