[PATCH] replace INVARIANTS+panic() with KASSERT
Pawel Jakub Dawidek
pjd at FreeBSD.org
Fri Sep 17 19:16:33 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, have you actually tried to boot with your patch in place?
Every single change you made is wrong. You converted:
if (cond)
panic("message");
to:
KASSERT(cond, "message");
But assertions don't work this way. It should be:
KASSERT(!cond, "message");
One more thing:
> -#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"));
You replaced printf() with KASSERT(9) here, not panic(9).
--
Pawel Jakub Dawidek http://www.wheelsystems.com
pjd at FreeBSD.org http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!
-------------- 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/85ce09ba/attachment.pgp
More information about the freebsd-fs
mailing list