o Change the locking scheme for swp_bcount.

It can now be accessed with a write lock on the object containing it OR
  with a read lock on the object containing it along with the swhash_mtx.
o Remove some duplicate assertions for swap_pager_freespace() and
  swap_pager_unswapped() but keep the object locking references for
  documentation.

Sponsored by:	EMC / Isilon storage division
Reviewed by:	alc
This commit is contained in:
Attilio Rao 2013-05-28 22:07:23 +00:00
parent c7d4c9d9af
commit c25673ffd6

View File

@ -822,12 +822,13 @@ swp_pager_freeswapspace(daddr_t blk, int npages)
* The external callers of this routine typically have already destroyed
* or renamed vm_page_t's associated with this range in the object so
* we should be ok.
*
* The object must be locked.
*/
void
swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size)
{
VM_OBJECT_ASSERT_WLOCKED(object);
swp_pager_meta_free(object, start, size);
}
@ -999,7 +1000,7 @@ swap_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, int *aft
{
daddr_t blk0;
VM_OBJECT_ASSERT_WLOCKED(object);
VM_OBJECT_ASSERT_LOCKED(object);
/*
* do we have good backing store at the requested index ?
*/
@ -1065,12 +1066,13 @@ swap_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, int *aft
* depends on it.
*
* This routine may not sleep.
*
* The object containing the page must be locked.
*/
static void
swap_pager_unswapped(vm_page_t m)
{
VM_OBJECT_ASSERT_WLOCKED(m->object);
swp_pager_meta_ctl(m->object, m->pindex, SWM_FREE);
}
@ -1916,7 +1918,7 @@ static void
swp_pager_meta_free(vm_object_t object, vm_pindex_t index, daddr_t count)
{
VM_OBJECT_ASSERT_WLOCKED(object);
VM_OBJECT_ASSERT_LOCKED(object);
if (object->type != OBJT_SWAP)
return;
@ -2021,7 +2023,7 @@ swp_pager_meta_ctl(vm_object_t object, vm_pindex_t pindex, int flags)
daddr_t r1;
int idx;
VM_OBJECT_ASSERT_WLOCKED(object);
VM_OBJECT_ASSERT_LOCKED(object);
/*
* The meta data only exists of the object is OBJT_SWAP
* and even then might not be allocated yet.