Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/nfsclient/nfs_clbio.c
Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | ncl_getpages(struct vop_getpages_args *ap) | ||||
/* | /* | ||||
* If the requested page is partially valid, just return it and | * If the requested page is partially valid, just return it and | ||||
* allow the pager to zero-out the blanks. Partially valid pages | * allow the pager to zero-out the blanks. Partially valid pages | ||||
* can only occur at the file EOF. | * can only occur at the file EOF. | ||||
* | * | ||||
* XXXGL: is that true for NFS, where short read can occur??? | * XXXGL: is that true for NFS, where short read can occur??? | ||||
*/ | */ | ||||
VM_OBJECT_WLOCK(object); | VM_OBJECT_WLOCK(object); | ||||
if (pages[npages - 1]->valid != 0 && --npages == 0) | if (!vm_page_none_valid(pages[npages - 1]) && --npages == 0) | ||||
goto out; | goto out; | ||||
VM_OBJECT_WUNLOCK(object); | VM_OBJECT_WUNLOCK(object); | ||||
/* | /* | ||||
* We use only the kva address for the buffer, but this is extremely | * We use only the kva address for the buffer, but this is extremely | ||||
* convenient and fast. | * convenient and fast. | ||||
*/ | */ | ||||
bp = uma_zalloc(ncl_pbuf_zone, M_WAITOK); | bp = uma_zalloc(ncl_pbuf_zone, M_WAITOK); | ||||
Show All 36 Lines | for (i = 0, toff = 0; i < npages; i++, toff = nextoff) { | ||||
vm_page_t m; | vm_page_t m; | ||||
nextoff = toff + PAGE_SIZE; | nextoff = toff + PAGE_SIZE; | ||||
m = pages[i]; | m = pages[i]; | ||||
if (nextoff <= size) { | if (nextoff <= size) { | ||||
/* | /* | ||||
* Read operation filled an entire page | * Read operation filled an entire page | ||||
*/ | */ | ||||
m->valid = VM_PAGE_BITS_ALL; | vm_page_valid(m); | ||||
KASSERT(m->dirty == 0, | KASSERT(m->dirty == 0, | ||||
("nfs_getpages: page %p is dirty", m)); | ("nfs_getpages: page %p is dirty", m)); | ||||
} else if (size > toff) { | } else if (size > toff) { | ||||
/* | /* | ||||
* Read operation filled a partial page. | * Read operation filled a partial page. | ||||
*/ | */ | ||||
m->valid = 0; | vm_page_invalid(m); | ||||
vm_page_set_valid_range(m, 0, size - toff); | vm_page_set_valid_range(m, 0, size - toff); | ||||
KASSERT(m->dirty == 0, | KASSERT(m->dirty == 0, | ||||
("nfs_getpages: page %p is dirty", m)); | ("nfs_getpages: page %p is dirty", m)); | ||||
} else { | } else { | ||||
/* | /* | ||||
* Read operation was short. If no error | * Read operation was short. If no error | ||||
* occurred we may have hit a zero-fill | * occurred we may have hit a zero-fill | ||||
* section. We leave valid set to 0, and page | * section. We leave valid set to 0, and page | ||||
▲ Show 20 Lines • Show All 1,629 Lines • Show Last 20 Lines |