Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Sep 2010 22:09:07 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        "David O'Brien" <obrien@freebsd.org>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: [PATCH] replace INVARIANTS+panic() with KASSERT
Message-ID:  <20100917190907.GQ2389@deviant.kiev.zoral.com.ua>
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

--nWEzmRaGLXxZdI3i
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?
> --=20
> -- David  (obrien@FreeBSD.org)
>=20
>=20
> Index: IVs/ffs/ffs_softdep.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- ufs/ffs/ffs_softdep.c	(revision 212799)
> +++ ufs/ffs/ffs_softdep.c	(working copy)
> @@ -6015,11 +6015,9 @@ handle_complete_freeblocks(freeblks)
>  		vput(vp);
>  	}
> =20
> -#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"));
Isn't this reverted ? I believe that all conditions for panics/printf
should be reverted in KASSERTs.

> =20
>  	ACQUIRE_LOCK(&lk);
>  	/*
> @@ -6089,12 +6087,7 @@ indir_trunc(freework, dbn, lbn)
>  	 * a complete copy of the indirect block in memory for our use.
>  	 * Otherwise we have to read the blocks in from the disk.
>  	 */
> -#ifdef notyet
> -	bp =3D getblk(freeblks->fb_devvp, dbn, (int)fs->fs_bsize, 0, 0,
> -	    GB_NOCREAT);
> -#else
>  	bp =3D incore(&freeblks->fb_devvp->v_bufobj, dbn);
> -#endif
>  	ACQUIRE_LOCK(&lk);
>  	if (bp !=3D NULL && (wk =3D LIST_FIRST(&bp->b_dep)) !=3D NULL) {
>  		if (wk->wk_type !=3D D_INDIRDEP ||
> @@ -6109,10 +6102,6 @@ indir_trunc(freework, dbn, lbn)
>  		ump->um_numindirdeps -=3D 1;
>  		FREE_LOCK(&lk);
>  	} else {
> -#ifdef notyet
> -		if (bp)
> -			brelse(bp);
> -#endif
Please leave both notyet blocks in indir_trunc() as is.
There are patches in progress that change this fragments, and you
supposedly seen them.

--nWEzmRaGLXxZdI3i
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkyTvNMACgkQC3+MBN1Mb4iaoACgo9laYXI+5727zodwTlog26pl
3U8AoISPP2jXWjGF4a6+1qQZa1CzrI85
=ERrv
-----END PGP SIGNATURE-----

--nWEzmRaGLXxZdI3i--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100917190907.GQ2389>