Date: Fri, 17 Sep 2010 22:09:07 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: "David O'Brien" <obrien@freebsd.org> Cc: freebsd-fs@freebsd.org Subject: Re: [PATCH] replace INVARIANTS+panic() with KASSERT Message-ID: <20100917190907.GQ2389@deviant.kiev.zoral.com.ua> In-Reply-To: <20100917180738.GA51572@dragon.NUXI.org> References: <20100917180738.GA51572@dragon.NUXI.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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@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.
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)
iEYEARECAAYFAkyTvNMACgkQC3+MBN1Mb4iaoACgo9laYXI+5727zodwTlog26pl
3U8AoISPP2jXWjGF4a6+1qQZa1CzrI85
=ERrv
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100917190907.GQ2389>
