Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/device_pager.c
Show First 20 Lines • Show All 283 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
dev_pager_getpages(vm_object_t object, vm_page_t *ma, int count, int *rbehind, | dev_pager_getpages(vm_object_t object, vm_page_t *ma, int count, int *rbehind, | ||||
int *rahead) | int *rahead) | ||||
{ | { | ||||
int error; | int error; | ||||
/* 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); | |||||
if (object->un_pager.devp.ops->cdev_pg_fault == NULL) | if (object->un_pager.devp.ops->cdev_pg_fault == NULL) | ||||
return (VM_PAGER_FAIL); | return (VM_PAGER_FAIL); | ||||
VM_OBJECT_WLOCK(object); | |||||
error = object->un_pager.devp.ops->cdev_pg_fault(object, | error = object->un_pager.devp.ops->cdev_pg_fault(object, | ||||
IDX_TO_OFF(ma[0]->pindex), PROT_READ, &ma[0]); | IDX_TO_OFF(ma[0]->pindex), PROT_READ, &ma[0]); | ||||
VM_OBJECT_ASSERT_WLOCKED(object); | VM_OBJECT_ASSERT_WLOCKED(object); | ||||
if (error == VM_PAGER_OK) { | if (error == VM_PAGER_OK) { | ||||
KASSERT((object->type == OBJT_DEVICE && | KASSERT((object->type == OBJT_DEVICE && | ||||
(ma[0]->oflags & VPO_UNMANAGED) != 0) || | (ma[0]->oflags & VPO_UNMANAGED) != 0) || | ||||
(object->type == OBJT_MGTDEVICE && | (object->type == OBJT_MGTDEVICE && | ||||
(ma[0]->oflags & VPO_UNMANAGED) == 0), | (ma[0]->oflags & VPO_UNMANAGED) == 0), | ||||
("Wrong page type %p %p", ma[0], object)); | ("Wrong page type %p %p", ma[0], object)); | ||||
if (object->type == OBJT_DEVICE) { | if (object->type == OBJT_DEVICE) { | ||||
TAILQ_INSERT_TAIL(&object->un_pager.devp.devp_pglist, | TAILQ_INSERT_TAIL(&object->un_pager.devp.devp_pglist, | ||||
ma[0], plinks.q); | ma[0], plinks.q); | ||||
} | } | ||||
if (rbehind) | if (rbehind) | ||||
*rbehind = 0; | *rbehind = 0; | ||||
if (rahead) | if (rahead) | ||||
*rahead = 0; | *rahead = 0; | ||||
} | } | ||||
VM_OBJECT_WUNLOCK(object); | |||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
dev_pager_populate(vm_object_t object, vm_pindex_t pidx, int fault_type, | dev_pager_populate(vm_object_t object, vm_pindex_t pidx, int fault_type, | ||||
vm_prot_t max_prot, vm_pindex_t *first, vm_pindex_t *last) | vm_prot_t max_prot, vm_pindex_t *first, vm_pindex_t *last) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines |