Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_page.c
| Show First 20 Lines • Show All 1,845 Lines • ▼ Show 20 Lines | |||||||||
| vm_page_rename(vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex) | vm_page_rename(vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex) | ||||||||
| { | { | ||||||||
| vm_page_t mpred; | vm_page_t mpred; | ||||||||
| vm_pindex_t opidx; | vm_pindex_t opidx; | ||||||||
| VM_OBJECT_ASSERT_WLOCKED(new_object); | VM_OBJECT_ASSERT_WLOCKED(new_object); | ||||||||
| KASSERT(m->ref_count != 0, ("vm_page_rename: page %p has no refs", m)); | KASSERT(m->ref_count != 0, ("vm_page_rename: page %p has no refs", m)); | ||||||||
| mpred = vm_radix_lookup_le(&new_object->rtree, new_pindex); | |||||||||
| KASSERT(mpred == NULL || mpred->pindex != new_pindex, | |||||||||
| ("vm_page_rename: pindex already renamed")); | |||||||||
| /* | /* | ||||||||
| * Create a custom version of vm_page_insert() which does not depend | * Create a custom version of vm_page_insert() which does not depend | ||||||||
| * by m_prev and can cheat on the implementation aspects of the | * by m_prev and can cheat on the implementation aspects of the | ||||||||
| * function. | * function. | ||||||||
| */ | */ | ||||||||
| opidx = m->pindex; | opidx = m->pindex; | ||||||||
| m->pindex = new_pindex; | m->pindex = new_pindex; | ||||||||
| if (vm_radix_insert(&new_object->rtree, m)) { | if (vm_radix_insert_lookup_lt(&new_object->rtree, m, &mpred) != 0) { | ||||||||
kibUnsubmitted Not Done Inline Actions
kib: | |||||||||
| m->pindex = opidx; | m->pindex = opidx; | ||||||||
| return (1); | return (1); | ||||||||
| } | } | ||||||||
| /* | /* | ||||||||
| * The operation cannot fail anymore. The removal must happen before | * The operation cannot fail anymore. The removal must happen before | ||||||||
| * the listq iterator is tainted. | * the listq iterator is tainted. | ||||||||
| */ | */ | ||||||||
| ▲ Show 20 Lines • Show All 3,818 Lines • Show Last 20 Lines | |||||||||