From owner-svn-src-head@FreeBSD.ORG Thu Mar 8 20:27:21 2012 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 2257F106564A; Thu, 8 Mar 2012 20:27:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F55A8FC17; Thu, 8 Mar 2012 20:27:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q28KRKp8063344; Thu, 8 Mar 2012 20:27:20 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q28KRKri063338; Thu, 8 Mar 2012 20:27:20 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203082027.q28KRKri063338@svn.freebsd.org> From: John Baldwin Date: Thu, 8 Mar 2012 20:27:20 +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: r232701 - in head/sys: fs/unionfs kern ufs/ufs vm 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: Thu, 08 Mar 2012 20:27:21 -0000 Author: jhb Date: Thu Mar 8 20:27:20 2012 New Revision: 232701 URL: http://svn.freebsd.org/changeset/base/232701 Log: Add KTR_VFS traces to track modifications to a vnode's writecount. Modified: head/sys/fs/unionfs/union_subr.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c head/sys/ufs/ufs/ufs_extattr.c head/sys/vm/vnode_pager.c Modified: head/sys/fs/unionfs/union_subr.c ============================================================================== --- head/sys/fs/unionfs/union_subr.c Thu Mar 8 19:41:05 2012 (r232700) +++ head/sys/fs/unionfs/union_subr.c Thu Mar 8 20:27:20 2012 (r232701) @@ -952,6 +952,8 @@ unionfs_vn_create_on_upper(struct vnode goto unionfs_vn_create_on_upper_free_out1; } vp->v_writecount++; + CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d", __func__, vp, + vp->v_writecount); *vpp = vp; unionfs_vn_create_on_upper_free_out1: @@ -1087,6 +1089,8 @@ unionfs_copyfile(struct unionfs_node *un } VOP_CLOSE(uvp, FWRITE, cred, td); uvp->v_writecount--; + CTR3(KTR_VFS, "%s: vp %p v_writecount decreased to %d", __func__, uvp, + uvp->v_writecount); vn_finished_write(mp); Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Thu Mar 8 19:41:05 2012 (r232700) +++ head/sys/kern/vfs_syscalls.c Thu Mar 8 20:27:20 2012 (r232701) @@ -4591,16 +4591,22 @@ sys_fhopen(td, uap) if (error) goto bad; - if (fmode & FWRITE) + if (fmode & FWRITE) { vp->v_writecount++; + CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d", + __func__, vp, vp->v_writecount); + } /* * end of vn_open code */ if ((error = falloc(td, &nfp, &indx, fmode)) != 0) { - if (fmode & FWRITE) + if (fmode & FWRITE) { vp->v_writecount--; + CTR3(KTR_VFS, "%s: vp %p v_writecount decreased to %d", + __func__, vp, vp->v_writecount); + } goto bad; } /* An extra reference on `nfp' has been held for us by falloc(). */ Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Thu Mar 8 19:41:05 2012 (r232700) +++ head/sys/kern/vfs_vnops.c Thu Mar 8 20:27:20 2012 (r232701) @@ -245,8 +245,11 @@ restart: if ((error = VOP_OPEN(vp, fmode, cred, td, fp)) != 0) goto bad; - if (fmode & FWRITE) + if (fmode & FWRITE) { vp->v_writecount++; + CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d", + __func__, vp, vp->v_writecount); + } *flagp = fmode; ASSERT_VOP_LOCKED(vp, "vn_open_cred"); if (!mpsafe) @@ -309,6 +312,8 @@ vn_close(vp, flags, file_cred, td) VNASSERT(vp->v_writecount > 0, vp, ("vn_close: negative writecount")); vp->v_writecount--; + CTR3(KTR_VFS, "%s: vp %p v_writecount decreased to %d", + __func__, vp, vp->v_writecount); } error = VOP_CLOSE(vp, flags, file_cred, td); vput(vp); Modified: head/sys/ufs/ufs/ufs_extattr.c ============================================================================== --- head/sys/ufs/ufs/ufs_extattr.c Thu Mar 8 19:41:05 2012 (r232700) +++ head/sys/ufs/ufs/ufs_extattr.c Thu Mar 8 20:27:20 2012 (r232701) @@ -335,6 +335,8 @@ ufs_extattr_enable_with_open(struct ufsm } vp->v_writecount++; + CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d", __func__, vp, + vp->v_writecount); vref(vp); Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Thu Mar 8 19:41:05 2012 (r232700) +++ head/sys/vm/vnode_pager.c Thu Mar 8 20:27:20 2012 (r232701) @@ -272,6 +272,8 @@ vnode_pager_dealloc(object) if (object->un_pager.vnp.writemappings > 0) { object->un_pager.vnp.writemappings = 0; vp->v_writecount--; + CTR3(KTR_VFS, "%s: vp %p v_writecount decreased to %d", + __func__, vp, vp->v_writecount); } vp->v_object = NULL; vp->v_vflag &= ~VV_TEXT; @@ -1241,9 +1243,13 @@ vnode_pager_update_writecount(vm_object_ if (old_wm == 0 && object->un_pager.vnp.writemappings != 0) { ASSERT_VOP_ELOCKED(vp, "v_writecount inc"); vp->v_writecount++; + CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d", + __func__, vp, vp->v_writecount); } else if (old_wm != 0 && object->un_pager.vnp.writemappings == 0) { ASSERT_VOP_ELOCKED(vp, "v_writecount dec"); vp->v_writecount--; + CTR3(KTR_VFS, "%s: vp %p v_writecount decreased to %d", + __func__, vp, vp->v_writecount); } VM_OBJECT_UNLOCK(object); }