Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/sg_pager.c
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | sg_pager_getpages(vm_object_t object, vm_page_t *m, int count, int *rbehind, | ||||
vm_pindex_t offset; | vm_pindex_t offset; | ||||
vm_paddr_t paddr; | vm_paddr_t paddr; | ||||
vm_memattr_t memattr; | vm_memattr_t memattr; | ||||
size_t space; | size_t space; | ||||
int i; | int i; | ||||
/* Since our haspage reports zero after/before, the count is 1. */ | /* Since our haspage reports zero after/before, the count is 1. */ | ||||
KASSERT(count == 1, ("%s: count %d", __func__, count)); | KASSERT(count == 1, ("%s: count %d", __func__, count)); | ||||
VM_OBJECT_ASSERT_WLOCKED(object); | /* Handle is stable while paging is in progress. */ | ||||
sg = object->handle; | sg = object->handle; | ||||
memattr = object->memattr; | memattr = object->memattr; | ||||
VM_OBJECT_WUNLOCK(object); | |||||
offset = m[0]->pindex; | offset = m[0]->pindex; | ||||
/* | /* | ||||
* Lookup the physical address of the requested page. An initial | * Lookup the physical address of the requested page. An initial | ||||
* value of '1' instead of '0' is used so we can assert that the | * value of '1' instead of '0' is used so we can assert that the | ||||
* page is found since '0' can be a valid page-aligned physical | * page is found since '0' can be a valid page-aligned physical | ||||
* address. | * address. | ||||
*/ | */ | ||||
Show All 21 Lines | sg_pager_getpages(vm_object_t object, vm_page_t *m, int count, int *rbehind, | ||||
KASSERT(!(m[0]->flags & PG_FICTITIOUS), | KASSERT(!(m[0]->flags & PG_FICTITIOUS), | ||||
("backing page for SG is fake")); | ("backing page for SG is fake")); | ||||
/* Construct a new fake page. */ | /* Construct a new fake page. */ | ||||
page = vm_page_getfake(paddr, memattr); | page = vm_page_getfake(paddr, memattr); | ||||
VM_OBJECT_WLOCK(object); | VM_OBJECT_WLOCK(object); | ||||
TAILQ_INSERT_TAIL(&object->un_pager.sgp.sgp_pglist, page, plinks.q); | TAILQ_INSERT_TAIL(&object->un_pager.sgp.sgp_pglist, page, plinks.q); | ||||
vm_page_replace(page, object, offset, m[0]); | vm_page_replace(page, object, offset, m[0]); | ||||
VM_OBJECT_WUNLOCK(object); | |||||
m[0] = page; | m[0] = page; | ||||
vm_page_valid(page); | vm_page_valid(page); | ||||
if (rbehind) | if (rbehind) | ||||
*rbehind = 0; | *rbehind = 0; | ||||
if (rahead) | if (rahead) | ||||
*rahead = 0; | *rahead = 0; | ||||
Show All 22 Lines |