From owner-p4-projects@FreeBSD.ORG Thu May 2 18:54:00 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1177E5C5; Thu, 2 May 2013 18:54:00 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C78055C3 for ; Thu, 2 May 2013 18:53:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id A9A5110FC for ; Thu, 2 May 2013 18:53:59 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r42IrxaP097061 for ; Thu, 2 May 2013 18:53:59 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r42Irx06097058 for perforce@freebsd.org; Thu, 2 May 2013 18:53:59 GMT (envelope-from jhb@freebsd.org) Date: Thu, 2 May 2013 18:53:59 GMT Message-Id: <201305021853.r42Irx06097058@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 228334 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 May 2013 18:54:00 -0000 http://p4web.freebsd.org/@@228334?ac=10 Change 228334 by jhb@jhb_jhbbsd on 2013/05/02 18:53:11 IFC @228332 Affected files ... .. //depot/projects/smpng/sys/fs/tmpfs/tmpfs.h#16 integrate .. //depot/projects/smpng/sys/fs/tmpfs/tmpfs_subr.c#22 integrate .. //depot/projects/smpng/sys/fs/tmpfs/tmpfs_vnops.c#27 integrate .. //depot/projects/smpng/sys/vm/vm_mmap.c#98 integrate Differences ... ==== //depot/projects/smpng/sys/fs/tmpfs/tmpfs.h#16 (text+ko) ==== @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/sys/fs/tmpfs/tmpfs.h 248597 2013-03-21 22:44:33Z pjd $ + * $FreeBSD: head/sys/fs/tmpfs/tmpfs.h 250189 2013-05-02 18:44:31Z kib $ */ #ifndef _FS_TMPFS_TMPFS_H_ @@ -402,6 +402,7 @@ const char *, u_int, struct tmpfs_dirent **); void tmpfs_free_dirent(struct tmpfs_mount *, struct tmpfs_dirent *); void tmpfs_dirent_init(struct tmpfs_dirent *, const char *, u_int); +void tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj); int tmpfs_alloc_vp(struct mount *, struct tmpfs_node *, int, struct vnode **); void tmpfs_free_vp(struct vnode *); ==== //depot/projects/smpng/sys/fs/tmpfs/tmpfs_subr.c#22 (text+ko) ==== @@ -34,7 +34,7 @@ * Efficient memory file system supporting functions. */ #include -__FBSDID("$FreeBSD: head/sys/fs/tmpfs/tmpfs_subr.c 250030 2013-04-28 19:38:59Z kib $"); +__FBSDID("$FreeBSD: head/sys/fs/tmpfs/tmpfs_subr.c 250189 2013-05-02 18:44:31Z kib $"); #include #include @@ -429,7 +429,37 @@ /* --------------------------------------------------------------------- */ +void +tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj) +{ + + if (vp->v_type != VREG || obj == NULL) + return; + + VM_OBJECT_WLOCK(obj); + VI_LOCK(vp); + vm_object_clear_flag(obj, OBJ_TMPFS); + obj->un_pager.swp.swp_tmpfs = NULL; + VI_UNLOCK(vp); + VM_OBJECT_WUNLOCK(obj); +} + /* + * Need to clear v_object for insmntque failure. + */ +static void +tmpfs_insmntque_dtr(struct vnode *vp, void *dtr_arg) +{ + + tmpfs_destroy_vobject(vp, vp->v_object); + vp->v_object = NULL; + vp->v_data = NULL; + vp->v_op = &dead_vnodeops; + vgone(vp); + vput(vp); +} + +/* * Allocates a new vnode for the node node or returns a new reference to * an existing one if the node had already a vnode referencing it. The * resulting locked vnode is returned in *vpp. @@ -540,7 +570,7 @@ panic("tmpfs_alloc_vp: type %p %d", node, (int)node->tn_type); } - error = insmntque(vp, mp); + error = insmntque1(vp, mp, tmpfs_insmntque_dtr, NULL); if (error) vp = NULL; ==== //depot/projects/smpng/sys/fs/tmpfs/tmpfs_vnops.c#27 (text+ko) ==== @@ -34,7 +34,7 @@ * tmpfs vnode interface. */ #include -__FBSDID("$FreeBSD: head/sys/fs/tmpfs/tmpfs_vnops.c 250030 2013-04-28 19:38:59Z kib $"); +__FBSDID("$FreeBSD: head/sys/fs/tmpfs/tmpfs_vnops.c 250190 2013-05-02 18:46:31Z kib $"); #include #include @@ -264,6 +264,7 @@ error = EPERM; else { error = 0; + /* For regular files, the call below is nop. */ vnode_create_vobject(vp, node->tn_size, v->a_td); } @@ -494,7 +495,8 @@ vm_page_unhold(m); vm_page_deactivate(m); /* Requeue to maintain LRU ordering. */ - vm_page_requeue(m); + if (m->queue != PQ_NONE) + vm_page_requeue(m); vm_page_unlock(m); VM_OBJECT_WUNLOCK(tobj); @@ -609,7 +611,8 @@ vm_page_unhold(tpg); vm_page_deactivate(tpg); /* Requeue to maintain LRU ordering. */ - vm_page_requeue(tpg); + if (tpg->queue != PQ_NONE) + vm_page_requeue(tpg); vm_page_unlock(tpg); VM_OBJECT_WUNLOCK(tobj); @@ -1466,23 +1469,14 @@ struct tmpfs_mount *tmp; struct tmpfs_node *node; - vm_object_t obj; node = VP_TO_TMPFS_NODE(vp); tmp = VFS_TO_TMPFS(vp->v_mount); - if (node->tn_type == VREG) { - obj = node->tn_reg.tn_aobj; - if (obj != NULL) { - /* Instead of vnode_destroy_vobject() */ - VM_OBJECT_WLOCK(obj); - VI_LOCK(vp); - vm_object_clear_flag(obj, OBJ_TMPFS); - obj->un_pager.swp.swp_tmpfs = NULL; - VI_UNLOCK(vp); - VM_OBJECT_WUNLOCK(obj); - } - } + if (vp->v_type == VREG) + tmpfs_destroy_vobject(vp, node->tn_reg.tn_aobj); + else + vnode_destroy_vobject(vp); vp->v_object = NULL; cache_purge(vp); ==== //depot/projects/smpng/sys/vm/vm_mmap.c#98 (text+ko) ==== @@ -41,7 +41,7 @@ */ #include -__FBSDID("$FreeBSD: head/sys/vm/vm_mmap.c 250029 2013-04-28 19:25:09Z kib $"); +__FBSDID("$FreeBSD: head/sys/vm/vm_mmap.c 250187 2013-05-02 18:35:12Z kib $"); #include "opt_compat.h" #include "opt_hwpmc_hooks.h" @@ -1289,7 +1289,7 @@ vp = (struct vnode *)obj->handle; /* * Bypass filesystems obey the mpsafety of the - * underlying fs. + * underlying fs. Tmpfs never bypasses. */ error = vget(vp, locktype, td); if (error != 0)