[PATCH] replace INVARIANTS+panic() with KASSERT

Kostik Belousov kostikbel at gmail.com
Fri Sep 17 19:09:13 UTC 2010


On Fri, Sep 17, 2010 at 11:07:38AM -0700, David O'Brien wrote:
> This patch changes most of the "asserts" and panic() within
> #ifdef INVARIANTS of olden years with KASSERTS.
> 
> In doing so, it also changes some '"%s: blah", "thing"' with just
> '"thing: blah"' to make grep'ing easier.
> 
> Some "notyet" code from the early 2000s is also reaped.
> 
> Some sysctls are also added to make it easier to change some diagnostics
> values at runtime vs. I believe using the debugger to change them.
> 
> thoughts?
> -- 
> -- David  (obrien at FreeBSD.org)
> 
> 
> Index: IVs/ffs/ffs_softdep.c
> ===================================================================
> --- ufs/ffs/ffs_softdep.c	(revision 212799)
> +++ ufs/ffs/ffs_softdep.c	(working copy)
> @@ -6015,11 +6015,9 @@ handle_complete_freeblocks(freeblks)
>  		vput(vp);
>  	}
>  
> -#ifdef INVARIANTS
> -	if (freeblks->fb_chkcnt != 0 && 
> -	    ((fs->fs_flags & FS_UNCLEAN) == 0 || (flags & LK_NOWAIT) != 0))
> -		printf("handle_workitem_freeblocks: block count\n");
> -#endif /* INVARIANTS */
> +	KASSERT(freeblks->fb_chkcnt != 0 &&
> +	    ((fs->fs_flags & FS_UNCLEAN) == 0 || (flags & LK_NOWAIT) != 0),
> +	    ("handle_workitem_freeblocks: block count"));
Isn't this reverted ? I believe that all conditions for panics/printf
should be reverted in KASSERTs.

>  
>  	ACQUIRE_LOCK(&lk);
>  	/*
> @@ -6089,12 +6087,7 @@ indir_trunc(freework, dbn, lbn)
>  	 * a complete copy of the indirect block in memory for our use.
>  	 * Otherwise we have to read the blocks in from the disk.
>  	 */
> -#ifdef notyet
> -	bp = getblk(freeblks->fb_devvp, dbn, (int)fs->fs_bsize, 0, 0,
> -	    GB_NOCREAT);
> -#else
>  	bp = incore(&freeblks->fb_devvp->v_bufobj, dbn);
> -#endif
>  	ACQUIRE_LOCK(&lk);
>  	if (bp != NULL && (wk = LIST_FIRST(&bp->b_dep)) != NULL) {
>  		if (wk->wk_type != D_INDIRDEP ||
> @@ -6109,10 +6102,6 @@ indir_trunc(freework, dbn, lbn)
>  		ump->um_numindirdeps -= 1;
>  		FREE_LOCK(&lk);
>  	} else {
> -#ifdef notyet
> -		if (bp)
> -			brelse(bp);
> -#endif
Please leave both notyet blocks in indir_trunc() as is.
There are patches in progress that change this fragments, and you
supposedly seen them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20100917/0830c254/attachment.pgp


More information about the freebsd-fs mailing list