[PATCH] replace INVARIANTS+panic() with KASSERT

David O'Brien obrien at FreeBSD.org
Sun Sep 19 01:08:02 UTC 2010


On Fri, Sep 17, 2010 at 09:16:09PM +0200, Pawel Jakub Dawidek wrote:
> David, have you actually tried to boot with your patch in place?
> Every single change you made is wrong. You converted:

Yes, caught that after extracting the changes from how I was first
testing the change (which had the KASSERT macro as a printf instead of
panic).

I knew I had more testing to go, but wanted to know if folks thought the
changes were positive or if I would get resistance to changing these to
KASSERT()s.

 
> 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).

Correct.  If this is truly an INVARIANTS we should panic.
Should the "#ifdef INVARIANTS" be changed to #ifdef DIAGNOSTIC"?

-- 
-- David  (obrien at FreeBSD.org)


More information about the freebsd-fs mailing list