mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-05 09:14:03 +00:00
Move the contents of vop_stddestroyvobject() to the new vnode_pager
function vnode_destroy_vobject(). Make the new function zero the vp->v_object pointer so we can tell if a call is missing.
This commit is contained in:
parent
268334ebbd
commit
7146d6cb3e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140929
@ -366,32 +366,8 @@ vop_stddestroyvobject(ap)
|
||||
struct vnode *vp;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
vm_object_t obj = vp->v_object;
|
||||
|
||||
if (obj == NULL)
|
||||
return (0);
|
||||
VM_OBJECT_LOCK(obj);
|
||||
if (obj->ref_count == 0) {
|
||||
/*
|
||||
* vclean() may be called twice. The first time
|
||||
* removes the primary reference to the object,
|
||||
* the second time goes one further and is a
|
||||
* special-case to terminate the object.
|
||||
*
|
||||
* don't double-terminate the object
|
||||
*/
|
||||
if ((obj->flags & OBJ_DEAD) == 0)
|
||||
vm_object_terminate(obj);
|
||||
else
|
||||
VM_OBJECT_UNLOCK(obj);
|
||||
} else {
|
||||
/*
|
||||
* Woe to the process that tries to page now :-).
|
||||
*/
|
||||
vm_pager_deallocate(obj);
|
||||
VM_OBJECT_UNLOCK(obj);
|
||||
}
|
||||
vnode_destroy_vobject(ap->a_vp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -687,6 +687,7 @@ void vbusy(struct vnode *vp);
|
||||
void v_addpollinfo(struct vnode *vp);
|
||||
|
||||
int vnode_create_vobject(struct vnode *vp, size_t size, struct thread *td);
|
||||
void vnode_destroy_vobject(struct vnode *vp);
|
||||
|
||||
extern struct vop_vector fifo_specops;
|
||||
extern struct vop_vector dead_vnodeops;
|
||||
|
@ -150,6 +150,39 @@ vnode_create_vobject(struct vnode *vp, size_t isize, struct thread *td)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
vnode_destroy_vobject(struct vnode *vp)
|
||||
{
|
||||
struct vm_object *obj;
|
||||
|
||||
obj = vp->v_object;
|
||||
if (obj == NULL)
|
||||
return;
|
||||
vp->v_object = NULL;
|
||||
VM_OBJECT_LOCK(obj);
|
||||
if (obj->ref_count == 0) {
|
||||
/*
|
||||
* vclean() may be called twice. The first time
|
||||
* removes the primary reference to the object,
|
||||
* the second time goes one further and is a
|
||||
* special-case to terminate the object.
|
||||
*
|
||||
* don't double-terminate the object
|
||||
*/
|
||||
if ((obj->flags & OBJ_DEAD) == 0)
|
||||
vm_object_terminate(obj);
|
||||
else
|
||||
VM_OBJECT_UNLOCK(obj);
|
||||
} else {
|
||||
/*
|
||||
* Woe to the process that tries to page now :-).
|
||||
*/
|
||||
vm_pager_deallocate(obj);
|
||||
VM_OBJECT_UNLOCK(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Allocate (or lookup) pager for a vnode.
|
||||
* Handle is a vnode pointer.
|
||||
|
Loading…
Reference in New Issue
Block a user