Subject: Re: Panics in #define DIAGNOSTIC code ?
To: Heiko W.Rupp <email@example.com>
From: Jason Thorpe <firstname.lastname@example.org>
Date: 05/01/1999 12:05:40
On Sat, 1 May 1999 13:24:05 +0200
"Heiko W.Rupp" <email@example.com> wrote:
> 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");
> 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.
> - the checked invariant is not important, so a printf() is enough
> - 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 <firstname.lastname@example.org>