diff options
author | alc <alc@FreeBSD.org> | 2004-04-06 07:12:32 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2004-04-06 07:12:32 +0000 |
commit | 728ea9afc21bf876dc79cb1a03479a112317abee (patch) | |
tree | 7640e5831412dfbd27d319b1fd79fce0bcca8150 /sys/vm | |
parent | 3bc22d914f27af4715c47a09dc508d3f57607bc6 (diff) | |
download | FreeBSD-src-728ea9afc21bf876dc79cb1a03479a112317abee.zip FreeBSD-src-728ea9afc21bf876dc79cb1a03479a112317abee.tar.gz |
Eliminate vm_pager_map_page() and vm_pager_unmap_page() and their uses.
Use sf_buf_alloc() and sf_buf_free() instead.
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_pager.c | 20 | ||||
-rw-r--r-- | sys/vm/vm_pager.h | 2 | ||||
-rw-r--r-- | sys/vm/vnode_pager.c | 22 |
3 files changed, 12 insertions, 32 deletions
diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 322d5d9..669aebd 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -267,26 +267,6 @@ vm_pager_deallocate(object) * vm_pager_has_page() - inline, see vm/vm_pager.h */ -vm_offset_t -vm_pager_map_page(m) - vm_page_t m; -{ - vm_offset_t kva; - - kva = kmem_alloc_wait(pager_map, PAGE_SIZE); - pmap_qenter(kva, &m, 1); - return (kva); -} - -void -vm_pager_unmap_page(kva) - vm_offset_t kva; -{ - - pmap_qremove(kva, 1); - kmem_free_wakeup(pager_map, kva, PAGE_SIZE); -} - vm_object_t vm_pager_object_lookup(pg_list, handle) struct pagerlst *pg_list; diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index d4f43e3..c365ff8 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -106,8 +106,6 @@ static __inline int vm_pager_get_pages(vm_object_t, vm_page_t *, int, int); static __inline boolean_t vm_pager_has_page(vm_object_t, vm_pindex_t, int *, int *); void vm_pager_init(void); vm_object_t vm_pager_object_lookup(struct pagerlst *, void *); -vm_offset_t vm_pager_map_page(vm_page_t); -void vm_pager_unmap_page(vm_offset_t); /* * vm_page_get_pages: diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index fd69c66..1cce9ab 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include <sys/buf.h> #include <sys/vmmeter.h> #include <sys/conf.h> +#include <sys/sf_buf.h> #include <vm/vm.h> #include <vm/vm_object.h> @@ -427,7 +428,7 @@ vnode_pager_input_smlfs(object, m) int i; struct vnode *dp, *vp; struct buf *bp; - vm_offset_t kva; + struct sf_buf *sf; int fileaddr; vm_offset_t bsize; int error = 0; @@ -442,7 +443,7 @@ vnode_pager_input_smlfs(object, m) VOP_BMAP(vp, 0, &dp, 0, NULL, NULL); - kva = vm_pager_map_page(m); + sf = sf_buf_alloc(m, 0); for (i = 0; i < PAGE_SIZE / bsize; i++) { vm_ooffset_t address; @@ -466,7 +467,7 @@ vnode_pager_input_smlfs(object, m) KASSERT(bp->b_wcred == NOCRED, ("leaking write ucred")); bp->b_rcred = crhold(curthread->td_ucred); bp->b_wcred = crhold(curthread->td_ucred); - bp->b_data = (caddr_t) kva + i * bsize; + bp->b_data = (caddr_t)sf_buf_kva(sf) + i * bsize; bp->b_blkno = fileaddr; pbgetvp(dp, bp); bp->b_bcount = bsize; @@ -506,10 +507,10 @@ vnode_pager_input_smlfs(object, m) vm_page_set_validclean(m, (i * bsize) & PAGE_MASK, bsize); vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); - bzero((caddr_t) kva + i * bsize, bsize); + bzero((caddr_t)sf_buf_kva(sf) + i * bsize, bsize); } } - vm_pager_unmap_page(kva); + sf_buf_free(sf); vm_page_lock_queues(); pmap_clear_modify(m); vm_page_flag_clear(m, PG_ZERO); @@ -534,7 +535,7 @@ vnode_pager_input_old(object, m) struct iovec aiov; int error; int size; - vm_offset_t kva; + struct sf_buf *sf; struct vnode *vp; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); @@ -556,9 +557,9 @@ vnode_pager_input_old(object, m) * Allocate a kernel virtual address and initialize so that * we can use VOP_READ/WRITE routines. */ - kva = vm_pager_map_page(m); + sf = sf_buf_alloc(m, 0); - aiov.iov_base = (caddr_t) kva; + aiov.iov_base = (caddr_t)sf_buf_kva(sf); aiov.iov_len = size; auio.uio_iov = &aiov; auio.uio_iovcnt = 1; @@ -575,9 +576,10 @@ vnode_pager_input_old(object, m) if (count == 0) error = EINVAL; else if (count != PAGE_SIZE) - bzero((caddr_t) kva + count, PAGE_SIZE - count); + bzero((caddr_t)sf_buf_kva(sf) + count, + PAGE_SIZE - count); } - vm_pager_unmap_page(kva); + sf_buf_free(sf); VM_OBJECT_LOCK(object); } |