Date: Fri, 17 Sep 2010 21:16:09 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: David O'Brien <obrien@freebsd.org> Cc: freebsd-fs@freebsd.org Subject: Re: [PATCH] replace INVARIANTS+panic() with KASSERT Message-ID: <20100917191609.GA1902@garage.freebsd.pl> 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
--0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > In doing so, it also changes some '"%s: blah", "thing"' with just > '"thing: blah"' to make grep'ing easier. >=20 > Some "notyet" code from the early 2000s is also reaped. >=20 > 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. >=20 > 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 !=3D 0 &&=20 > - ((fs->fs_flags & FS_UNCLEAN) =3D=3D 0 || (flags & LK_NOWAIT) !=3D 0= )) > - printf("handle_workitem_freeblocks: block count\n"); > -#endif /* INVARIANTS */ > + KASSERT(freeblks->fb_chkcnt !=3D 0 && > + ((fs->fs_flags & FS_UNCLEAN) =3D=3D 0 || (flags & LK_NOWAIT) !=3D 0= ), > + ("handle_workitem_freeblocks: block count")); You replaced printf() with KASSERT(9) here, not panic(9). --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --0OAP2g/MAC+5xKAE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyTvnkACgkQForvXbEpPzRrlgCgvcS7Mgq5v52ct5Vc57L2+U8/ 8lsAoJBYLkOrgdTymPVWqZVrsYuH+jOH =ASuH -----END PGP SIGNATURE----- --0OAP2g/MAC+5xKAE--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100917191609.GA1902>