Filesystem INVARIANTS

Bruce Evans brde at optusnet.com.au
Sat Nov 3 03:50:45 PDT 2007


On Fri, 26 Oct 2007, David O'Brien wrote:

> Hi folks,
>
> Looking at the code in sys/ufs, I think most of the "DIAGNOSTIC"s should
> really be "INVARIANTS"s.  In fact there are no "INVARIANTS" in the
> filesystem code at this time.

I like not having much clutter from INVARIANTS/KASSERT()s, but having
things under DIAGNOSTICs isn't right.  In fs code, there should be
some unconditional checking that the file system isn't corrupt.  That
doesn't belong under any ifdefs (since the errors it finds are more
like errors in user input than logic errors), and it mostly already
isn't.

> Below is a diff of what I feel should change from "DIAGNOSTIC" to
> "INVARIANTS".  I have not yet had a chance to benchmark the impact of
> this change when only INVARIANTS/INVARIANTS_SUPORT and not DIAGNOSTIC is
> set vs. nothing set.

This changes a few things that are probably only caused by corrupt file
systems, and many things where it isn't clear what the causes might be.
OTOH, there are lots of panics that aren't under any ifdef but are probably
only caused by logic errors.

Bruce


More information about the freebsd-arch mailing list