summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2006-01-09 12:43:18 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2006-01-09 12:43:18 +0000
commitfb4205421dd06345cb985ab4252728fdb3a7a304 (patch)
tree5fb7c27ad703407502e64635f74ff375fb280958 /sys
parent046383c234884c958ab6ca9ea5fddba703102e1b (diff)
Put vprint() under DIAGNOSTIC, as to save space in generated ramdisks.
Inspiration from miod@, okay deraadt@. Tested on i386, macppc and amd64.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ccd.c6
-rw-r--r--sys/isofs/cd9660/cd9660_node.c11
-rw-r--r--sys/kern/vfs_subr.c12
-rw-r--r--sys/kern/vfs_sync.c4
-rw-r--r--sys/msdosfs/msdosfs_denode.c17
-rw-r--r--sys/nfs/nfs_node.c8
-rw-r--r--sys/ntfs/ntfs_vnops.c6
-rw-r--r--sys/sys/vnode.h6
-rw-r--r--sys/ufs/ext2fs/ext2fs_inode.c7
-rw-r--r--sys/ufs/ext2fs/ext2fs_vnops.c4
-rw-r--r--sys/ufs/ufs/ufs_inode.c7
-rw-r--r--sys/ufs/ufs/ufs_vnops.c7
-rw-r--r--sys/xfs/xfs_message.c5
13 files changed, 77 insertions, 23 deletions
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index 7ace8fa669e..7a309e12a63 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ccd.c,v 1.63 2005/09/13 17:26:16 mickey Exp $ */
+/* $OpenBSD: ccd.c,v 1.64 2006/01/09 12:43:16 pedro Exp $ */
/* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */
/*-
@@ -1287,8 +1287,10 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
* cause Bad Things. Maybe we need to force
* the close to happen?
*/
+#ifdef DIAGNOSTIC
CCD_DCALL(CCDB_VNODE, vprint("CCDIOCCLR: vnode info",
cs->sc_cinfo[i].ci_vp));
+#endif
(void)vn_close(cs->sc_cinfo[i].ci_vp, FREAD|FWRITE,
p->p_ucred, p);
@@ -1461,7 +1463,9 @@ ccdlookup(char *path, struct proc *p, struct vnode **vpp)
return (ENOTBLK);
}
+#ifdef DIAGNOSTIC
CCD_DCALL(CCDB_VNODE, vprint("ccdlookup: vnode info", vp));
+#endif
VOP_UNLOCK(vp, 0, p);
*vpp = vp;
diff --git a/sys/isofs/cd9660/cd9660_node.c b/sys/isofs/cd9660/cd9660_node.c
index f7c6abda357..c538b32f378 100644
--- a/sys/isofs/cd9660/cd9660_node.c
+++ b/sys/isofs/cd9660/cd9660_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_node.c,v 1.15 2005/11/19 02:18:01 pedro Exp $ */
+/* $OpenBSD: cd9660_node.c,v 1.16 2006/01/09 12:43:16 pedro Exp $ */
/* $NetBSD: cd9660_node.c,v 1.17 1997/05/05 07:13:57 mycroft Exp $ */
/*-
@@ -243,9 +243,11 @@ cd9660_inactive(v)
struct proc *p = ap->a_p;
register struct iso_node *ip = VTOI(vp);
int error = 0;
-
+
+#ifdef DIAGNOSTIC
if (prtactive && vp->v_usecount != 0)
vprint("cd9660_inactive: pushing active", vp);
+#endif
ip->i_flag = 0;
VOP_UNLOCK(vp, 0, p);
@@ -271,9 +273,12 @@ cd9660_reclaim(v)
} */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct iso_node *ip = VTOI(vp);
-
+
+#ifdef DIAGNOSTIC
if (prtactive && vp->v_usecount != 0)
vprint("cd9660_reclaim: pushing active", vp);
+#endif
+
/*
* Remove the inode from its hash chain.
*/
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 0416a45e382..55aeb0c6a4e 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.121 2005/11/30 10:35:07 pedro Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.122 2006/01/09 12:43:16 pedro Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -415,10 +415,13 @@ getnewvnode(enum vtagtype tag, struct mount *mp, int (**vops)(void *),
*vpp = 0;
return (ENFILE);
}
+
+#ifdef DIAGNOSTIC
if (vp->v_usecount) {
vprint("free vnode", vp);
panic("free vnode isn't");
}
+#endif
TAILQ_REMOVE(listhd, vp, v_freelist);
vp->v_bioflag &= ~VBIOONFREELIST;
@@ -804,8 +807,11 @@ vrele(struct vnode *vp)
panic("vrele: v_writecount != 0");
}
#endif
+
if (vn_lock(vp, LK_EXCLUSIVE|LK_INTERLOCK, p)) {
+#ifdef DIAGNOSTIC
vprint("vrele: cannot lock", vp);
+#endif
return;
}
@@ -1269,6 +1275,7 @@ loop:
return (count);
}
+#ifdef DIAGNOSTIC
/*
* Print out a description of a vnode.
*/
@@ -1313,6 +1320,7 @@ vprint(char *label, struct vnode *vp)
VOP_PRINT(vp);
}
}
+#endif /* DIAGNOSTIC */
#ifdef DEBUG
/*
@@ -2016,7 +2024,9 @@ loop:
vwaitforio(vp, 0, "vflushbuf", 0);
if (!LIST_EMPTY(&vp->v_dirtyblkhd)) {
splx(s);
+#ifdef DIAGNOSTIC
vprint("vflushbuf: dirty", vp);
+#endif
goto loop;
}
splx(s);
diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c
index 62a280afcaa..0d55326971f 100644
--- a/sys/kern/vfs_sync.c
+++ b/sys/kern/vfs_sync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_sync.c,v 1.36 2005/11/30 10:35:07 pedro Exp $ */
+/* $OpenBSD: vfs_sync.c,v 1.37 2006/01/09 12:43:16 pedro Exp $ */
/*
* Portions of this code are:
@@ -176,6 +176,7 @@ sched_sync(struct proc *p)
* since sync_fsync() moves it to a different
* slot we are safe.
*/
+#ifdef DIAGNOSTIC
if (LIST_FIRST(&vp->v_dirtyblkhd) == NULL &&
vp->v_type != VBLK) {
vprint("fsync failed", vp);
@@ -184,6 +185,7 @@ sched_sync(struct proc *p)
vp->v_mount->mnt_stat.f_mntonname);
panic("sched_sync: fsync failed");
}
+#endif /* DIAGNOSTIC */
/*
* Put us back on the worklist. The worklist
* routine will remove us from our current
diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c
index 9601e819f2d..eb219370b9e 100644
--- a/sys/msdosfs/msdosfs_denode.c
+++ b/sys/msdosfs/msdosfs_denode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_denode.c,v 1.27 2004/06/24 19:35:25 tholo Exp $ */
+/* $OpenBSD: msdosfs_denode.c,v 1.28 2006/01/09 12:43:16 pedro Exp $ */
/* $NetBSD: msdosfs_denode.c,v 1.23 1997/10/17 11:23:58 ws Exp $ */
/*-
@@ -593,15 +593,18 @@ msdosfs_reclaim(v)
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(vp);
+#ifdef DIAGNOSTIC
extern int prtactive;
+
+ if (prtactive && vp->v_usecount != 0)
+ vprint("msdosfs_reclaim(): pushing active", vp);
+#endif
#ifdef MSDOSFS_DEBUG
printf("msdosfs_reclaim(): dep %08x, file %s, refcnt %d\n",
dep, dep->de_Name, dep->de_refcnt);
#endif
- if (prtactive && vp->v_usecount != 0)
- vprint("msdosfs_reclaim(): pushing active", vp);
/*
* Remove the denode from its hash chain.
*/
@@ -634,15 +637,17 @@ msdosfs_inactive(v)
struct denode *dep = VTODE(vp);
struct proc *p = ap->a_p;
int error;
+#ifdef DIAGNOSTIC
extern int prtactive;
+
+ if (prtactive && vp->v_usecount != 0)
+ vprint("msdosfs_inactive(): pushing active", vp);
+#endif
#ifdef MSDOSFS_DEBUG
printf("msdosfs_inactive(): dep %08x, de_Name[0] %x\n", dep, dep->de_Name[0]);
#endif
- if (prtactive && vp->v_usecount != 0)
- vprint("msdosfs_inactive(): pushing active", vp);
-
error = 0;
/*
diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c
index da95868cc50..e74d17a39bb 100644
--- a/sys/nfs/nfs_node.c
+++ b/sys/nfs/nfs_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_node.c,v 1.30 2005/11/19 15:48:04 pedro Exp $ */
+/* $OpenBSD: nfs_node.c,v 1.31 2006/01/09 12:43:16 pedro Exp $ */
/* $NetBSD: nfs_node.c,v 1.16 1996/02/18 11:53:42 fvdl Exp $ */
/*
@@ -169,8 +169,12 @@ nfs_inactive(v)
struct proc *p = curproc; /* XXX */
np = VTONFS(ap->a_vp);
+
+#ifdef DIAGNOSTIC
if (prtactive && ap->a_vp->v_usecount != 0)
vprint("nfs_inactive: pushing active", ap->a_vp);
+#endif
+
if (ap->a_vp->v_type != VDIR) {
sp = np->n_sillyrename;
np->n_sillyrename = (struct sillyrename *)0;
@@ -206,8 +210,10 @@ nfs_reclaim(v)
struct nfsnode *np = VTONFS(vp);
struct nfsdmap *dp, *dp2;
+#ifdef DIAGNOSTIC
if (prtactive && vp->v_usecount != 0)
vprint("nfs_reclaim: pushing active", vp);
+#endif
if (np->n_hash.le_prev != NULL)
LIST_REMOVE(np, n_hash);
diff --git a/sys/ntfs/ntfs_vnops.c b/sys/ntfs/ntfs_vnops.c
index b02cc40c137..83b957fc56c 100644
--- a/sys/ntfs/ntfs_vnops.c
+++ b/sys/ntfs/ntfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_vnops.c,v 1.9 2005/10/19 16:50:47 pedro Exp $ */
+/* $OpenBSD: ntfs_vnops.c,v 1.10 2006/01/09 12:43:16 pedro Exp $ */
/* $NetBSD: ntfs_vnops.c,v 1.6 2003/04/10 21:57:26 jdolecek Exp $ */
/*
@@ -267,8 +267,10 @@ ntfs_inactive(ap)
dprintf(("ntfs_inactive: vnode: %p, ntnode: %d\n", vp, ip->i_number));
+#ifdef DIAGNOSTIC
if (ntfs_prtactive && vp->v_usecount != 0)
vprint("ntfs_inactive: pushing active", vp);
+#endif
VOP__UNLOCK(vp, 0, p);
@@ -298,8 +300,10 @@ ntfs_reclaim(ap)
dprintf(("ntfs_reclaim: vnode: %p, ntnode: %d\n", vp, ip->i_number));
+#ifdef DIAGNOSTIC
if (ntfs_prtactive && vp->v_usecount != 0)
vprint("ntfs_reclaim: pushing active", vp);
+#endif
#ifndef __OpenBSD__
if ((error = ntfs_ntget(ip)) != 0)
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 74c13536ed7..858c83b63be 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnode.h,v 1.65 2005/12/04 19:04:13 pedro Exp $ */
+/* $OpenBSD: vnode.h,v 1.66 2006/01/09 12:43:17 pedro Exp $ */
/* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */
/*
@@ -436,7 +436,9 @@ void vgone(struct vnode *vp);
void vgonel(struct vnode *, struct proc *);
int vinvalbuf(struct vnode *vp, int save, struct ucred *cred,
struct proc *p, int slpflag, int slptimeo);
-void vprint(char *label, struct vnode *vp);
+#ifdef DIAGNOSTIC
+void vprint(char *, struct vnode *);
+#endif
int vop_generic_bwrite(void *ap);
int vn_access(struct vnode *, int);
void vn_update(void);
diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c
index 57d37e6d360..03dfb174b57 100644
--- a/sys/ufs/ext2fs/ext2fs_inode.c
+++ b/sys/ufs/ext2fs/ext2fs_inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_inode.c,v 1.31 2005/12/15 13:44:28 krw Exp $ */
+/* $OpenBSD: ext2fs_inode.c,v 1.32 2006/01/09 12:43:17 pedro Exp $ */
/* $NetBSD: ext2fs_inode.c,v 1.24 2001/06/19 12:59:18 wiz Exp $ */
/*
@@ -117,10 +117,13 @@ ext2fs_inactive(v)
struct proc *p = ap->a_p;
struct timespec ts;
int error = 0;
+#ifdef DIAGNOSTIC
extern int prtactive;
-
+
if (prtactive && vp->v_usecount != 0)
vprint("ext2fs_inactive: pushing active", vp);
+#endif
+
/* Get rid of inodes related to stale file handles. */
if (ip->i_e2fs_mode == 0 || ip->i_e2fs_dtime != 0)
goto out;
diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c
index 9d4a23fab82..a5fb2cdb455 100644
--- a/sys/ufs/ext2fs/ext2fs_vnops.c
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vnops.c,v 1.43 2005/12/14 22:03:01 pedro Exp $ */
+/* $OpenBSD: ext2fs_vnops.c,v 1.44 2006/01/09 12:43:17 pedro Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */
/*
@@ -1327,10 +1327,12 @@ ext2fs_reclaim(v)
} */ *ap = v;
register struct vnode *vp = ap->a_vp;
struct inode *ip;
+#ifdef DIAGNOSTIC
extern int prtactive;
if (prtactive && vp->v_usecount != 0)
vprint("ext2fs_reclaim: pushing active", vp);
+#endif
/*
* Remove the inode from its hash chain.
diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c
index 6fbade9a37b..5860865e5d9 100644
--- a/sys/ufs/ufs/ufs_inode.c
+++ b/sys/ufs/ufs/ufs_inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_inode.c,v 1.33 2005/12/28 20:48:18 pedro Exp $ */
+/* $OpenBSD: ufs_inode.c,v 1.34 2006/01/09 12:43:17 pedro Exp $ */
/* $NetBSD: ufs_inode.c,v 1.7 1996/05/11 18:27:52 mycroft Exp $ */
/*
@@ -72,10 +72,12 @@ ufs_inactive(void *v)
struct proc *p = ap->a_p;
mode_t mode;
int error = 0;
+#ifdef DIAGNOSTIC
extern int prtactive;
if (prtactive && vp->v_usecount != 0)
vprint("ffs_inactive: pushing active", vp);
+#endif
/*
* Ignore inodes related to stale file handles.
@@ -135,10 +137,13 @@ int
ufs_reclaim(struct vnode *vp, struct proc *p)
{
struct inode *ip;
+#ifdef DIAGNOSTIC
extern int prtactive;
if (prtactive && vp->v_usecount != 0)
vprint("ufs_reclaim: pushing active", vp);
+#endif
+
/*
* Remove the inode from its hash chain.
*/
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 98ea0844735..0efa09d83e0 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_vnops.c,v 1.71 2005/12/28 20:48:18 pedro Exp $ */
+/* $OpenBSD: ufs_vnops.c,v 1.72 2006/01/09 12:43:17 pedro Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */
/*
@@ -1706,9 +1706,11 @@ ufs_strategy(void *v)
int
ufs_print(void *v)
{
+#ifdef DIAGNOSTIC
struct vop_print_args /* {
struct vnode *a_vp;
} */ *ap = v;
+
struct vnode *vp = ap->a_vp;
struct inode *ip = VTOI(vp);
@@ -1725,6 +1727,9 @@ ufs_print(void *v)
#endif /* FIFO */
lockmgr_printinfo(&ip->i_lock);
printf("\n");
+
+#endif /* DIAGNOSTIC */
+
return (0);
}
diff --git a/sys/xfs/xfs_message.c b/sys/xfs/xfs_message.c
index d9dfaffa187..7f8e59241cd 100644
--- a/sys/xfs/xfs_message.c
+++ b/sys/xfs/xfs_message.c
@@ -442,12 +442,13 @@ gc_vnode (struct vnode *vp,
return;
}
#endif /* __FreeBSD__ */
-
- /* DIAGNOSTIC */
+
+#ifdef DIAGNOSTIC
if (vp->v_usecount < 0 || vp->v_writecount != 0) {
vprint("vrele: bad ref count", vp);
panic("vrele: ref cnt");
}
+#endif /* DIAGNOSTIC */
NNPFSDEB(XDEBMSG, ("xfs_message_gc: success\n"));