MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vnode_pager_dealloc

Function vnode_pager_dealloc

freebsd/vm/vnode_pager.c:304–344  ·  view source on GitHub ↗

* The object must be locked. */

Source from the content-addressed store, hash-verified

302 * The object must be locked.
303 */
304static void
305vnode_pager_dealloc(vm_object_t object)
306{
307 struct vnode *vp;
308 int refs;
309
310 vp = object->handle;
311 if (vp == NULL)
312 panic("vnode_pager_dealloc: pager already dealloced");
313
314 VM_OBJECT_ASSERT_WLOCKED(object);
315 vm_object_pip_wait(object, "vnpdea");
316 refs = object->ref_count;
317
318 object->handle = NULL;
319 object->type = OBJT_DEAD;
320 ASSERT_VOP_ELOCKED(vp, "vnode_pager_dealloc");
321 if (object->un_pager.vnp.writemappings > 0) {
322 object->un_pager.vnp.writemappings = 0;
323 VOP_ADD_WRITECOUNT_CHECKED(vp, -1);
324 CTR3(KTR_VFS, "%s: vp %p v_writecount decreased to %d",
325 __func__, vp, vp->v_writecount);
326 }
327 vp->v_object = NULL;
328 VI_LOCK(vp);
329
330 /*
331 * vm_map_entry_set_vnode_text() cannot reach this vnode by
332 * following object->handle. Clear all text references now.
333 * This also clears the transient references from
334 * kern_execve(), which is fine because dead_vnodeops uses nop
335 * for VOP_UNSET_TEXT().
336 */
337 if (vp->v_writecount < 0)
338 vp->v_writecount = 0;
339 VI_UNLOCK(vp);
340 VM_OBJECT_WUNLOCK(object);
341 if (refs > 0)
342 vunref(vp);
343 VM_OBJECT_WLOCK(object);
344}
345
346static boolean_t
347vnode_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before,

Callers

nothing calls this directly

Calls 3

vm_object_pip_waitFunction · 0.85
vunrefFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected