Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vnode_pager.c
Show First 20 Lines • Show All 460 Lines • ▼ Show 20 Lines | if ((nsize & PAGE_MASK) && | ||||
/* | /* | ||||
* Clear out partial-page dirty bits. | * Clear out partial-page dirty bits. | ||||
* | * | ||||
* note that we do not clear out the valid | * note that we do not clear out the valid | ||||
* bits. This would prevent bogus_page | * bits. This would prevent bogus_page | ||||
* replacement from working properly. | * replacement from working properly. | ||||
*/ | */ | ||||
vm_page_clear_dirty(m, base, PAGE_SIZE - base); | vm_page_clear_dirty(m, base, PAGE_SIZE - base); | ||||
} else if ((nsize & PAGE_MASK) && | |||||
vm_page_is_cached(object, OFF_TO_IDX(nsize))) { | |||||
vm_page_cache_free(object, OFF_TO_IDX(nsize), | |||||
nobjsize); | |||||
} | } | ||||
} | } | ||||
object->un_pager.vnp.vnp_size = nsize; | object->un_pager.vnp.vnp_size = nsize; | ||||
object->size = nobjsize; | object->size = nobjsize; | ||||
VM_OBJECT_WUNLOCK(object); | VM_OBJECT_WUNLOCK(object); | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 408 Lines • ▼ Show 20 Lines | if (rbehind) { | ||||
if ((p = TAILQ_PREV(m[0], pglist, listq)) != NULL && | if ((p = TAILQ_PREV(m[0], pglist, listq)) != NULL && | ||||
p->pindex >= startpindex) | p->pindex >= startpindex) | ||||
startpindex = p->pindex + 1; | startpindex = p->pindex + 1; | ||||
/* tpindex is unsigned; beware of numeric underflow. */ | /* tpindex is unsigned; beware of numeric underflow. */ | ||||
for (tpindex = m[0]->pindex - 1; | for (tpindex = m[0]->pindex - 1; | ||||
tpindex >= startpindex && tpindex < m[0]->pindex; | tpindex >= startpindex && tpindex < m[0]->pindex; | ||||
tpindex--, i++) { | tpindex--, i++) { | ||||
p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | | p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); | ||||
VM_ALLOC_IFNOTCACHED); | |||||
if (p == NULL) { | if (p == NULL) { | ||||
/* Shift the array. */ | /* Shift the array. */ | ||||
for (int j = 0; j < i; j++) | for (int j = 0; j < i; j++) | ||||
bp->b_pages[j] = bp->b_pages[j + | bp->b_pages[j] = bp->b_pages[j + | ||||
tpindex + 1 - startpindex]; | tpindex + 1 - startpindex]; | ||||
break; | break; | ||||
} | } | ||||
bp->b_pages[tpindex - startpindex] = p; | bp->b_pages[tpindex - startpindex] = p; | ||||
Show All 20 Lines | if (rahead) { | ||||
if ((p = TAILQ_NEXT(m[count - 1], listq)) != NULL && | if ((p = TAILQ_NEXT(m[count - 1], listq)) != NULL && | ||||
p->pindex < endpindex) | p->pindex < endpindex) | ||||
endpindex = p->pindex; | endpindex = p->pindex; | ||||
if (endpindex > object->size) | if (endpindex > object->size) | ||||
endpindex = object->size; | endpindex = object->size; | ||||
for (tpindex = m[count - 1]->pindex + 1; | for (tpindex = m[count - 1]->pindex + 1; | ||||
tpindex < endpindex; i++, tpindex++) { | tpindex < endpindex; i++, tpindex++) { | ||||
p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | | p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); | ||||
VM_ALLOC_IFNOTCACHED); | |||||
if (p == NULL) | if (p == NULL) | ||||
break; | break; | ||||
bp->b_pages[i] = p; | bp->b_pages[i] = p; | ||||
} | } | ||||
bp->b_pgafter = i - bp->b_npages; | bp->b_pgafter = i - bp->b_npages; | ||||
bp->b_npages = i; | bp->b_npages = i; | ||||
} else | } else | ||||
▲ Show 20 Lines • Show All 439 Lines • Show Last 20 Lines |