svn commit: r251658 - head/sys/fs/ext2fs

Pedro F. Giffuni pfg at FreeBSD.org
Wed Jun 12 15:24:49 UTC 2013


Author: pfg
Date: Wed Jun 12 15:24:48 2013
New Revision: 251658
URL: http://svnweb.freebsd.org/changeset/base/251658

Log:
  Turn DIAGNOSTICs to INVARIANTS in ext2fs.
  
  This is done to be consistent with what other filesystems and
  particularly ffs already does (see r173464).
  
  MFC after:	5 days

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c
  head/sys/fs/ext2fs/ext2_balloc.c
  head/sys/fs/ext2fs/ext2_inode.c
  head/sys/fs/ext2fs/ext2_lookup.c
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_alloc.c	Wed Jun 12 15:23:17 2013	(r251657)
+++ head/sys/fs/ext2fs/ext2_alloc.c	Wed Jun 12 15:24:48 2013	(r251658)
@@ -91,7 +91,7 @@ ext2_alloc(struct inode *ip, int32_t lbn
 	fs = ip->i_e2fs;
 	ump = ip->i_ump;
 	mtx_assert(EXT2_MTX(ump), MA_OWNED);
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 	if ((u_int)size > fs->e2fs_bsize || blkoff(fs, size) != 0) {
 		vn_printf(ip->i_devvp, "bsize = %lu, size = %d, fs = %s\n",
 		    (long unsigned int)fs->e2fs_bsize, size, fs->e2fs_fsmnt);
@@ -99,7 +99,7 @@ ext2_alloc(struct inode *ip, int32_t lbn
 	}
 	if (cred == NOCRED)
 		panic("ext2_alloc: missing credential");
-#endif /* DIAGNOSTIC */
+#endif /* INVARIANTS */
 	if (size == fs->e2fs_bsize && fs->e2fs->e2fs_fbcount == 0)
 		goto nospace;
 	if (cred->cr_uid != 0 && 
@@ -183,7 +183,7 @@ ext2_reallocblks(struct vop_reallocblks_
 	len = buflist->bs_nchildren;
 	start_lbn = buflist->bs_children[0]->b_lblkno;
 	end_lbn = start_lbn + len - 1;
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 	for (i = 1; i < len; i++)
 		if (buflist->bs_children[i]->b_lblkno != start_lbn + i)
 			panic("ext2_reallocblks: non-cluster");
@@ -232,7 +232,7 @@ ext2_reallocblks(struct vop_reallocblks_
 	if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) {
 		ssize = len;
 	} else {
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 		if (start_ap[start_lvl-1].in_lbn == idp->in_lbn)
 			panic("ext2_reallocblks: start == end");
 #endif
@@ -271,7 +271,7 @@ ext2_reallocblks(struct vop_reallocblks_
 			bap = ebap;
 			soff = -i;
 		}
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 		if (buflist->bs_children[i]->b_blkno != fsbtodb(fs, *bap))
 			panic("ext2_reallocblks: alloc mismatch");
 #endif
@@ -748,7 +748,7 @@ retry:
 		return (0);
 	}
 gotit:
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 	if (isset(bbp, bno)) {
 		printf("ext2fs_alloccgblk: cg=%d bno=%jd fs=%s\n",
 			cg, (intmax_t)bno, fs->e2fs_fsmnt);

Modified: head/sys/fs/ext2fs/ext2_balloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_balloc.c	Wed Jun 12 15:23:17 2013	(r251657)
+++ head/sys/fs/ext2fs/ext2_balloc.c	Wed Jun 12 15:24:48 2013	(r251658)
@@ -152,7 +152,7 @@ ext2_balloc(struct inode *ip, int32_t lb
 	pref = 0;
 	if ((error = ext2_getlbns(vp, lbn, indirs, &num)) != 0)
 		return (error);
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 	if (num < 1)
 		panic ("ext2_balloc: ext2_getlbns returned indirect block");
 #endif

Modified: head/sys/fs/ext2fs/ext2_inode.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_inode.c	Wed Jun 12 15:23:17 2013	(r251657)
+++ head/sys/fs/ext2fs/ext2_inode.c	Wed Jun 12 15:24:48 2013	(r251658)
@@ -133,7 +133,7 @@ ext2_truncate(struct vnode *vp, off_t le
 
 	if (ovp->v_type == VLNK &&
 	    oip->i_size < ovp->v_mount->mnt_maxsymlinklen) {
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 		if (length != 0)
 			panic("ext2_truncate: partial truncate of symlink");
 #endif
@@ -319,7 +319,7 @@ ext2_truncate(struct vnode *vp, off_t le
 		}
 	}
 done:
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 	for (level = SINGLE; level <= TRIPLE; level++)
 		if (newblks[NDADDR + level] != oip->i_ib[level])
 			panic("itrunc1");
@@ -331,7 +331,7 @@ done:
 	    bo->bo_clean.bv_cnt != 0))
 		panic("itrunc3");
 	BO_UNLOCK(bo);
-#endif /* DIAGNOSTIC */
+#endif /* INVARIANTS */
 	/*
 	 * Put back the real size.
 	 */

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_lookup.c	Wed Jun 12 15:23:17 2013	(r251657)
+++ head/sys/fs/ext2fs/ext2_lookup.c	Wed Jun 12 15:24:48 2013	(r251658)
@@ -62,7 +62,7 @@
 #include <fs/ext2fs/ext2_dir.h>
 #include <fs/ext2fs/ext2_extern.h>
 
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 static int dirchk = 1;
 #else
 static int dirchk = 0;
@@ -790,7 +790,7 @@ ext2_direnter(struct inode *ip, struct v
 	int     DIRBLKSIZ = ip->i_e2fs->e2fs_bsize;
 
 
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 	if ((cnp->cn_flags & SAVENAME) == 0)
 		panic("ext2_direnter: missing name");
 #endif

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vnops.c	Wed Jun 12 15:23:17 2013	(r251657)
+++ head/sys/fs/ext2fs/ext2_vnops.c	Wed Jun 12 15:24:48 2013	(r251658)
@@ -657,7 +657,7 @@ ext2_link(struct vop_link_args *ap)
 	struct inode *ip;
 	int error;
 
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 	if ((cnp->cn_flags & HASBUF) == 0)
 		panic("ext2_link: no name");
 #endif
@@ -726,7 +726,7 @@ ext2_rename(struct vop_rename_args *ap)
 	int error = 0;
 	u_char namlen;
 
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 	if ((tcnp->cn_flags & HASBUF) == 0 ||
 	    (fcnp->cn_flags & HASBUF) == 0)
 		panic("ext2_rename: no name");
@@ -1077,7 +1077,7 @@ ext2_mkdir(struct vop_mkdir_args *ap)
 	struct dirtemplate dirtemplate, *dtp;
 	int error, dmode;
 
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 	if ((cnp->cn_flags & HASBUF) == 0)
 		panic("ext2_mkdir: no name");
 #endif
@@ -1486,7 +1486,7 @@ ext2_makeinode(int mode, struct vnode *d
 	int error;
 
 	pdir = VTOI(dvp);
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
 	if ((cnp->cn_flags & HASBUF) == 0)
 		panic("ext2_makeinode: no name");
 #endif


More information about the svn-src-all mailing list