From 77b193c249bc24bf860d9dd6b264d4bfe456ac0e Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Wed, 12 Jun 2013 15:24:48 +0000 Subject: [PATCH] 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 --- sys/fs/ext2fs/ext2_alloc.c | 12 ++++++------ sys/fs/ext2fs/ext2_balloc.c | 2 +- sys/fs/ext2fs/ext2_inode.c | 6 +++--- sys/fs/ext2fs/ext2_lookup.c | 4 ++-- sys/fs/ext2fs/ext2_vnops.c | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sys/fs/ext2fs/ext2_alloc.c b/sys/fs/ext2fs/ext2_alloc.c index 633ac28ff531..3bd5f3a3bbe1 100644 --- a/sys/fs/ext2fs/ext2_alloc.c +++ b/sys/fs/ext2fs/ext2_alloc.c @@ -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); diff --git a/sys/fs/ext2fs/ext2_balloc.c b/sys/fs/ext2fs/ext2_balloc.c index bacc1fa2b12c..ce73840c407c 100644 --- a/sys/fs/ext2fs/ext2_balloc.c +++ b/sys/fs/ext2fs/ext2_balloc.c @@ -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 diff --git a/sys/fs/ext2fs/ext2_inode.c b/sys/fs/ext2fs/ext2_inode.c index 4c4e7b6d7237..d1e872c1fd79 100644 --- a/sys/fs/ext2fs/ext2_inode.c +++ b/sys/fs/ext2fs/ext2_inode.c @@ -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. */ diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c index b9a2f8011543..75b11a8b6401 100644 --- a/sys/fs/ext2fs/ext2_lookup.c +++ b/sys/fs/ext2fs/ext2_lookup.c @@ -62,7 +62,7 @@ #include #include -#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 diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index 77eb74b2d6a8..ebf154e7dcca 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -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