From owner-freebsd-fs@FreeBSD.ORG Fri Sep 17 19:16:33 2010 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8499B106564A for ; Fri, 17 Sep 2010 19:16:33 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 216D38FC08 for ; Fri, 17 Sep 2010 19:16:32 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 8EAAE45E11; Fri, 17 Sep 2010 21:16:31 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 263B245C99; Fri, 17 Sep 2010 21:16:26 +0200 (CEST) Date: Fri, 17 Sep 2010 21:16:09 +0200 From: Pawel Jakub Dawidek To: David O'Brien Message-ID: <20100917191609.GA1902@garage.freebsd.pl> References: <20100917180738.GA51572@dragon.NUXI.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline In-Reply-To: <20100917180738.GA51572@dragon.NUXI.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: freebsd-fs@freebsd.org Subject: Re: [PATCH] replace INVARIANTS+panic() with KASSERT X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2010 19:16:33 -0000 --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--