vm_contig.c (156224) | vm_contig.c (156225) |
---|---|
1/*- 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 46 unchanged lines hidden (view full) --- 55 * Carnegie Mellon University 56 * Pittsburgh PA 15213-3890 57 * 58 * any improvements or extensions that they make and grant Carnegie the 59 * rights to redistribute these changes. 60 */ 61 62#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 46 unchanged lines hidden (view full) --- 55 * Carnegie Mellon University 56 * Pittsburgh PA 15213-3890 57 * 58 * any improvements or extensions that they make and grant Carnegie the 59 * rights to redistribute these changes. 60 */ 61 62#include <sys/cdefs.h> |
63__FBSDID("$FreeBSD: head/sys/vm/vm_contig.c 156224 2006-03-02 21:38:38Z tegge $"); | 63__FBSDID("$FreeBSD: head/sys/vm/vm_contig.c 156225 2006-03-02 22:13:28Z tegge $"); |
64 65#include <sys/param.h> 66#include <sys/systm.h> 67#include <sys/lock.h> 68#include <sys/malloc.h> 69#include <sys/mutex.h> 70#include <sys/proc.h> 71#include <sys/kernel.h> --- 14 unchanged lines hidden (view full) --- 86#include <vm/vm_extern.h> 87 88static int 89vm_contig_launder_page(vm_page_t m) 90{ 91 vm_object_t object; 92 vm_page_t m_tmp; 93 struct vnode *vp; | 64 65#include <sys/param.h> 66#include <sys/systm.h> 67#include <sys/lock.h> 68#include <sys/malloc.h> 69#include <sys/mutex.h> 70#include <sys/proc.h> 71#include <sys/kernel.h> --- 14 unchanged lines hidden (view full) --- 86#include <vm/vm_extern.h> 87 88static int 89vm_contig_launder_page(vm_page_t m) 90{ 91 vm_object_t object; 92 vm_page_t m_tmp; 93 struct vnode *vp; |
94 struct mount *mp; |
|
94 95 object = m->object; 96 if (!VM_OBJECT_TRYLOCK(object)) 97 return (EAGAIN); 98 if (vm_page_sleep_if_busy(m, TRUE, "vpctw0")) { 99 VM_OBJECT_UNLOCK(object); 100 vm_page_lock_queues(); 101 return (EBUSY); 102 } 103 vm_page_test_dirty(m); 104 if (m->dirty == 0 && m->hold_count == 0) 105 pmap_remove_all(m); 106 if (m->dirty) { 107 if (object->type == OBJT_VNODE) { 108 vm_page_unlock_queues(); 109 vp = object->handle; 110 vm_object_reference_locked(object); 111 VM_OBJECT_UNLOCK(object); | 95 96 object = m->object; 97 if (!VM_OBJECT_TRYLOCK(object)) 98 return (EAGAIN); 99 if (vm_page_sleep_if_busy(m, TRUE, "vpctw0")) { 100 VM_OBJECT_UNLOCK(object); 101 vm_page_lock_queues(); 102 return (EBUSY); 103 } 104 vm_page_test_dirty(m); 105 if (m->dirty == 0 && m->hold_count == 0) 106 pmap_remove_all(m); 107 if (m->dirty) { 108 if (object->type == OBJT_VNODE) { 109 vm_page_unlock_queues(); 110 vp = object->handle; 111 vm_object_reference_locked(object); 112 VM_OBJECT_UNLOCK(object); |
113 (void) vn_start_write(vp, &mp, V_WAIT); |
|
112 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread); 113 VM_OBJECT_LOCK(object); 114 vm_object_page_clean(object, 0, 0, OBJPC_SYNC); 115 VM_OBJECT_UNLOCK(object); 116 VOP_UNLOCK(vp, 0, curthread); 117 vm_object_deallocate(object); | 114 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread); 115 VM_OBJECT_LOCK(object); 116 vm_object_page_clean(object, 0, 0, OBJPC_SYNC); 117 VM_OBJECT_UNLOCK(object); 118 VOP_UNLOCK(vp, 0, curthread); 119 vm_object_deallocate(object); |
120 vn_finished_write(mp); |
|
118 vm_page_lock_queues(); 119 return (0); 120 } else if (object->type == OBJT_SWAP || 121 object->type == OBJT_DEFAULT) { 122 m_tmp = m; 123 vm_pageout_flush(&m_tmp, 1, VM_PAGER_PUT_SYNC); 124 VM_OBJECT_UNLOCK(object); 125 return (0); --- 484 unchanged lines hidden --- | 121 vm_page_lock_queues(); 122 return (0); 123 } else if (object->type == OBJT_SWAP || 124 object->type == OBJT_DEFAULT) { 125 m_tmp = m; 126 vm_pageout_flush(&m_tmp, 1, VM_PAGER_PUT_SYNC); 127 VM_OBJECT_UNLOCK(object); 128 return (0); --- 484 unchanged lines hidden --- |