Add vm_object locking to vmspace_swap_count().

This commit is contained in:
Alan Cox 2003-04-30 00:43:17 +00:00
parent 3edc7b4e0b
commit 8ba20a48bd

View File

@ -363,15 +363,16 @@ vmspace_swap_count(struct vmspace *vmspace)
vm_object_t object;
if ((cur->eflags & MAP_ENTRY_IS_SUB_MAP) == 0 &&
(object = cur->object.vm_object) != NULL &&
object->type == OBJT_SWAP
) {
int n = (cur->end - cur->start) / PAGE_SIZE;
(object = cur->object.vm_object) != NULL) {
VM_OBJECT_LOCK(object);
if (object->type == OBJT_SWAP &&
object->un_pager.swp.swp_bcount != 0) {
int n = (cur->end - cur->start) / PAGE_SIZE;
if (object->un_pager.swp.swp_bcount) {
count += object->un_pager.swp.swp_bcount *
SWAP_META_PAGES * n / object->size + 1;
}
VM_OBJECT_UNLOCK(object);
}
}
return (count);