Various changes to vm_object_page_remove():

- Eliminate an odd, special-case feature:
   if start == end == 0 then all pages are removed.  Only one caller
   used this feature and that caller can trivially pass the object's
   size.
 - Assert that the vm_object is locked on entry; don't bother testing
   for a NULL vm_object.
 - Style: Fix lines that are longer than 80 characters.
This commit is contained in:
alc 2003-04-26 23:41:30 +00:00
parent bc99b2572b
commit d5ac0bc453
2 changed files with 8 additions and 8 deletions

View File

@ -1184,7 +1184,7 @@ vinvalbuf(vp, flags, cred, td, slpflag, slptimeo)
*/
if (VOP_GETVOBJECT(vp, &object) == 0) {
VM_OBJECT_LOCK(object);
vm_object_page_remove(object, 0, 0,
vm_object_page_remove(object, 0, object->size,
(flags & V_SAVE) ? TRUE : FALSE);
VM_OBJECT_UNLOCK(object);
}

View File

@ -1674,22 +1674,22 @@ vm_object_collapse(vm_object_t object)
* The object must be locked.
*/
void
vm_object_page_remove(vm_object_t object, vm_pindex_t start, vm_pindex_t end, boolean_t clean_only)
vm_object_page_remove(vm_object_t object, vm_pindex_t start, vm_pindex_t end,
boolean_t clean_only)
{
vm_page_t p, next;
int all;
if (object == NULL ||
object->resident_page_count == 0)
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
if (object->resident_page_count == 0)
return;
all = ((end == 0) && (start == 0));
/*
* Since physically-backed objects do not use managed pages, we can't
* remove pages from the object (we must instead remove the page
* references, and then destroy the object).
*/
KASSERT(object->type != OBJT_PHYS, ("attempt to remove pages from a physical object"));
KASSERT(object->type != OBJT_PHYS,
("attempt to remove pages from a physical object"));
vm_object_pip_add(object, 1);
again:
@ -1707,7 +1707,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t start, vm_pindex_t end, bo
* or (2) NULL.
*/
for (;
p != NULL && (all || p->pindex < end);
p != NULL && p->pindex < end;
p = next) {
next = TAILQ_NEXT(p, listq);