Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167363454
D21357.id61094.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D21357.id61094.diff
View Options
Index: sys/vm/vm_object.h
===================================================================
--- sys/vm/vm_object.h
+++ sys/vm/vm_object.h
@@ -323,7 +323,7 @@
void vm_object_collapse (vm_object_t);
void vm_object_deallocate (vm_object_t);
void vm_object_destroy (vm_object_t);
-void vm_object_terminate (vm_object_t);
+void vm_object_terminate_dead(vm_object_t);
void vm_object_set_writeable_dirty (vm_object_t);
void vm_object_init (void);
int vm_object_kvme_type(vm_object_t object, struct vnode **vpp);
Index: sys/vm/vm_object.c
===================================================================
--- sys/vm/vm_object.c
+++ sys/vm/vm_object.c
@@ -115,6 +115,7 @@
boolean_t *eio);
static boolean_t vm_object_page_remove_write(vm_page_t p, int flags,
boolean_t *clearobjflags);
+static void vm_object_terminate(vm_object_t);
static void vm_object_qcollapse(vm_object_t object);
static void vm_object_vndeallocate(vm_object_t object);
@@ -743,7 +744,7 @@
* The object must be locked.
* This routine may block.
*/
-void
+static void
vm_object_terminate(vm_object_t object)
{
@@ -752,29 +753,19 @@
/*
* Make sure no one uses us.
*/
+ KASSERT((object->flags & OBJ_DEAD) == 0,
+ ("double-terminating obj %p", object));
vm_object_set_flag(object, OBJ_DEAD);
- /*
- * Clean and free the pages, as appropriate. All references to the
- * object are gone, so we don't need to lock it.
- */
- if (object->type == OBJT_VNODE) {
- struct vnode *vp = (struct vnode *)object->handle;
-
- /*
- * Clean pages and flush buffers.
- */
- vm_object_page_clean(object, 0, 0, OBJPC_SYNC);
- VM_OBJECT_WUNLOCK(object);
-
- vinvalbuf(vp, V_SAVE, 0, 0);
-
- BO_LOCK(&vp->v_bufobj);
- vp->v_bufobj.bo_flag |= BO_DEAD;
- BO_UNLOCK(&vp->v_bufobj);
+ vm_object_terminate_dead(object);
+}
- VM_OBJECT_WLOCK(object);
- }
+void
+vm_object_terminate_dead(vm_object_t object)
+{
+ VM_OBJECT_ASSERT_WLOCKED(object);
+ KASSERT((object->flags & OBJ_DEAD) != 0,
+ ("terminating non-dead obj %p", object));
/*
* wait for the pageout daemon to be done with the object
Index: sys/vm/vnode_pager.c
===================================================================
--- sys/vm/vnode_pager.c
+++ sys/vm/vnode_pager.c
@@ -200,7 +200,22 @@
* don't double-terminate the object
*/
if ((obj->flags & OBJ_DEAD) == 0) {
- vm_object_terminate(obj);
+ vm_object_set_flag(obj, OBJ_DEAD);
+
+ /*
+ * Clean pages and flush buffers.
+ */
+ vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
+ VM_OBJECT_WUNLOCK(obj);
+
+ vinvalbuf(vp, V_SAVE, 0, 0);
+
+ BO_LOCK(&vp->v_bufobj);
+ vp->v_bufobj.bo_flag |= BO_DEAD;
+ BO_UNLOCK(&vp->v_bufobj);
+
+ VM_OBJECT_WLOCK(obj);
+ vm_object_terminate_dead(obj);
} else {
/*
* Waiters were already handled during object
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 22, 8:28 AM (10 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37069204
Default Alt Text
D21357.id61094.diff (2 KB)
Attached To
Mode
D21357: Move OBJT_VNODE specific code from vm_object_terminate() to vnode_destroy_vobject().
Attached
Detach File
Event Timeline
Log In to Comment