diff options
Diffstat (limited to 'sys/vm/vnode_pager.c')
-rw-r--r-- | sys/vm/vnode_pager.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 1b0dc7e..817516d 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -665,6 +665,39 @@ vnode_pager_getpages(vm_object_t object, vm_page_t *m, int count, int reqpage) } /* + * The implementation of VOP_GETPAGES() for local filesystems, where + * partially valid pages can only occur at the end of file. + */ +int +vnode_pager_local_getpages(struct vop_getpages_args *ap) +{ + vm_page_t mreq; + + mreq = ap->a_m[ap->a_reqpage]; + + /* + * Since the caller has busied the requested page, that page's valid + * field will not be changed by other threads. + */ + vm_page_assert_xbusied(mreq); + + /* + * The requested page has valid blocks. Invalid part can only + * exist at the end of file, and the page is made fully valid + * by zeroing in vm_pager_getpages(). Free non-requested + * pages, since no i/o is done to read its content. + */ + if (mreq->valid != 0) { + vm_pager_free_nonreq(mreq->object, ap->a_m, ap->a_reqpage, + round_page(ap->a_count) / PAGE_SIZE); + return (VM_PAGER_OK); + } + + return (vnode_pager_generic_getpages(ap->a_vp, ap->a_m, + ap->a_count, ap->a_reqpage)); +} + +/* * This is now called from local media FS's to operate against their * own vnodes if they fail to implement VOP_GETPAGES. */ |