summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2012-03-08 20:27:20 +0000
committerjhb <jhb@FreeBSD.org>2012-03-08 20:27:20 +0000
commit19feaba08bc6b84c117bd21cc71e139c6d086ed7 (patch)
tree8f19e446f40b0494d383b5102ee060aeb4617503 /sys/kern
parent4fea355eb2254754b2e522d87d81c5562252116a (diff)
downloadFreeBSD-src-19feaba08bc6b84c117bd21cc71e139c6d086ed7.zip
FreeBSD-src-19feaba08bc6b84c117bd21cc71e139c6d086ed7.tar.gz
Add KTR_VFS traces to track modifications to a vnode's writecount.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_syscalls.c10
-rw-r--r--sys/kern/vfs_vnops.c7
2 files changed, 14 insertions, 3 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 9b7cbe4..a8bb661 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -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(). */
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index ce2d701..d4b60f1 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -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);
OpenPOWER on IntegriCloud