From owner-svn-src-head@FreeBSD.ORG Sun Feb 22 19:50:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 118091065674; Sun, 22 Feb 2009 19:50:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E9B108FC1D; Sun, 22 Feb 2009 19:50:09 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1MJo9DH004946; Sun, 22 Feb 2009 19:50:09 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1MJo9DC004945; Sun, 22 Feb 2009 19:50:09 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200902221950.n1MJo9DC004945@svn.freebsd.org> From: Alan Cox Date: Sun, 22 Feb 2009 19:50:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188929 - head/sys/fs/tmpfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Feb 2009 19:50:10 -0000 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 #include #include -#include -#include + #include #include @@ -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); }