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
This commit is contained in:
Pedro F. Giffuni 2013-06-12 15:24:48 +00:00
parent a987ae075f
commit 77b193c249
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251658
5 changed files with 16 additions and 16 deletions

View File

@ -91,7 +91,7 @@ ext2_alloc(struct inode *ip, int32_t lbn, int32_t bpref, int size,
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, int32_t bpref, int size,
}
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_args *ap)
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_args *ap)
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_args *ap)
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 @@ ext2_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
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);

View File

@ -152,7 +152,7 @@ ext2_balloc(struct inode *ip, int32_t lbn, int size, struct ucred *cred,
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

View File

@ -133,7 +133,7 @@ ext2_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred,
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 length, int flags, struct ucred *cred,
}
}
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 @@ ext2_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred,
bo->bo_clean.bv_cnt != 0))
panic("itrunc3");
BO_UNLOCK(bo);
#endif /* DIAGNOSTIC */
#endif /* INVARIANTS */
/*
* Put back the real size.
*/

View File

@ -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 vnode *dvp, struct componentname *cnp)
int DIRBLKSIZ = ip->i_e2fs->e2fs_bsize;
#ifdef DIAGNOSTIC
#ifdef INVARIANTS
if ((cnp->cn_flags & SAVENAME) == 0)
panic("ext2_direnter: missing name");
#endif

View File

@ -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 *dvp, struct vnode **vpp,
int error;
pdir = VTOI(dvp);
#ifdef DIAGNOSTIC
#ifdef INVARIANTS
if ((cnp->cn_flags & HASBUF) == 0)
panic("ext2_makeinode: no name");
#endif