Date: Sun, 22 Feb 2009 19:50:09 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r188929 - head/sys/fs/tmpfs Message-ID: <200902221950.n1MJo9DC004945@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Sun Feb 22 19:50:09 2009 New Revision: 188929 URL: http://svn.freebsd.org/changeset/base/188929 Log: Use uiomove_fromphys() instead of the combination of sf_buf and uiomove(). This is not only shorter; it also eliminates unnecessary thread pinning on architectures that implement a direct map. MFC after: 3 weeks Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Sun Feb 22 19:23:58 2009 (r188928) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun Feb 22 19:50:09 2009 (r188929) @@ -52,8 +52,7 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_pager.h> -#include <sys/sched.h> -#include <sys/sf_buf.h> + #include <machine/_inttypes.h> #include <fs/fifofs/fifo.h> @@ -436,10 +435,9 @@ tmpfs_mappedread(vm_object_t vobj, vm_ob { vm_pindex_t idx; vm_page_t m; - struct sf_buf *sf; - off_t offset, addr; + vm_offset_t offset; + off_t addr; size_t tlen; - caddr_t va; int error; addr = uio->uio_offset; @@ -458,12 +456,7 @@ lookupvpg: goto lookupvpg; vm_page_busy(m); VM_OBJECT_UNLOCK(vobj); - sched_pin(); - sf = sf_buf_alloc(m, SFB_CPUPRIVATE); - va = (caddr_t)sf_buf_kva(sf); - error = uiomove(va + offset, tlen, uio); - sf_buf_free(sf); - sched_unpin(); + error = uiomove_fromphys(&m, offset, tlen, uio); VM_OBJECT_LOCK(vobj); vm_page_wakeup(m); VM_OBJECT_UNLOCK(vobj); @@ -487,12 +480,7 @@ nocache: vm_page_zero_invalid(m, TRUE); } VM_OBJECT_UNLOCK(tobj); - sched_pin(); - sf = sf_buf_alloc(m, SFB_CPUPRIVATE); - va = (caddr_t)sf_buf_kva(sf); - error = uiomove(va + offset, tlen, uio); - sf_buf_free(sf); - sched_unpin(); + error = uiomove_fromphys(&m, offset, tlen, uio); VM_OBJECT_LOCK(tobj); out: vm_page_lock_queues(); @@ -557,10 +545,9 @@ tmpfs_mappedwrite(vm_object_t vobj, vm_o { vm_pindex_t idx; vm_page_t vpg, tpg; - struct sf_buf *sf; - off_t offset, addr; + vm_offset_t offset; + off_t addr; size_t tlen; - caddr_t va; int error; error = 0; @@ -586,12 +573,7 @@ lookupvpg: vm_page_undirty(vpg); vm_page_unlock_queues(); VM_OBJECT_UNLOCK(vobj); - sched_pin(); - sf = sf_buf_alloc(vpg, SFB_CPUPRIVATE); - va = (caddr_t)sf_buf_kva(sf); - error = uiomove(va + offset, tlen, uio); - sf_buf_free(sf); - sched_unpin(); + error = uiomove_fromphys(&vpg, offset, tlen, uio); } else { VM_OBJECT_UNLOCK(vobj); vpg = NULL; @@ -613,14 +595,9 @@ nocache: vm_page_zero_invalid(tpg, TRUE); } VM_OBJECT_UNLOCK(tobj); - if (vpg == NULL) { - sched_pin(); - sf = sf_buf_alloc(tpg, SFB_CPUPRIVATE); - va = (caddr_t)sf_buf_kva(sf); - error = uiomove(va + offset, tlen, uio); - sf_buf_free(sf); - sched_unpin(); - } else { + if (vpg == NULL) + error = uiomove_fromphys(&tpg, offset, tlen, uio); + else { KASSERT(vpg->valid == VM_PAGE_BITS_ALL, ("parts of vpg invalid")); pmap_copy_page(vpg, tpg); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902221950.n1MJo9DC004945>