git: c8e9bad25a43 - stable/15 - vm_fault: add helper vm_fault_can_cow_rename()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 11 Oct 2025 05:08:36 UTC
The branch stable/15 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=c8e9bad25a439d8952a0e5b5e42b5b14d8102e25
commit c8e9bad25a439d8952a0e5b5e42b5b14d8102e25
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-07-24 10:47:52 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-10-11 05:08:13 +0000
vm_fault: add helper vm_fault_can_cow_rename()
(cherry picked from commit 3f05bbdbd80f2eefb647e595dc73e80d6186d6a5)
---
sys/vm/vm_fault.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index 0039a8786387..fff6558fba7e 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -1003,6 +1003,16 @@ vm_fault_relookup(struct faultstate *fs)
return (KERN_SUCCESS);
}
+static bool
+vm_fault_can_cow_rename(struct faultstate *fs)
+{
+ return (
+ /* Only one shadow object and no other refs. */
+ fs->object->shadow_count == 1 && fs->object->ref_count == 1 &&
+ /* No other ways to look the object up. */
+ fs->object->handle == NULL && (fs->object->flags & OBJ_ANON) != 0);
+}
+
static void
vm_fault_cow(struct faultstate *fs)
{
@@ -1020,15 +1030,7 @@ vm_fault_cow(struct faultstate *fs)
* object so that it will go out to swap when needed.
*/
is_first_object_locked = false;
- if (
- /*
- * Only one shadow object and no other refs.
- */
- fs->object->shadow_count == 1 && fs->object->ref_count == 1 &&
- /*
- * No other ways to look the object up
- */
- fs->object->handle == NULL && (fs->object->flags & OBJ_ANON) != 0 &&
+ if (vm_fault_can_cow_rename(fs) &&
/*
* We don't chase down the shadow chain and we can acquire locks.
*/