Subject: Re: Panics in #define DIAGNOSTIC code ?
To: Heiko W.Rupp <>
From: Jason Thorpe <>
List: tech-kern
Date: 05/01/1999 12:05:40
On Sat, 1 May 1999 13:24:05 +0200 
 "Heiko W.Rupp" <> wrote:

 > Hi,
 > looking at kern/7321, I saw that the panic mentioned 
 > is produced as result of 

Actually, it's the result of some other gode doing the wrong thing, and that
close needs to eb fixed.

 > #ifdef DIAGNOSTIC
 >                         if (ISSET(bp->b_flags, B_DONE|B_DELWRI) &&
 >                             bp->b_bcount < size)
 >                                 panic("getblk: block size invariant failed");
 > #endif
 > (kern/vfs_bio.c)
 > While it is a good idea, to have some invariant checking now and then,
 > I don't see the point to panic the system here.
 > Either 
 > - the checked invariant is not important, so a printf() is enough
 > or 
 > - the check is important as it could lead to inconsistent data
 > otherwise, then it shoudl always be executed and not only when
 > DIAGNOSTIC is defined.

I believe it's the latter... but DIAGNOSTIC is specifically for these
types of cheap sanity checks... i.e. the #ifdef is appropriate.

        -- Jason R. Thorpe <>