Re: [patch] pagecache-2.3.9-H3, bmap & ext2fs cleanup patch

Steve VanDevender (stevev@efn.org)
Sat, 26 Jun 1999 20:46:09 -0700 (PDT)


Albert D. Cahalan writes:
> Ingo's way:
> You have flags A, B, C, and D. Most bit patterns are illegal.
> When B and C are both set, you _know_ there is a bug.
>
> Your way:
> You have flags X and Y. No bit patterns are illegal. If a bug
> sets both flags by accident... well, nobody can tell that
> something has gone seriously wrong. I'm sure that _bad_ things
> happen when you treat a normal data block like a hole.

Albert, you are such a loon.

You might as well add ECC bits to all kernel variables and data
structures. That way you can detect when something stomps on
them, and even fix them afterwards. Of course, there is a little
overhead.

If there are only four states you need to distinguish, then using
two bits to encode them _is_ better, because you can dispatch on
all four possible states directly. If you use four bits to
encode four states it's much harder to dispatch (you have to make
more comparisons), not to mention that detecting _all_ the
illegal bit patterns (up to 12 out of the 16) adds a lot of
overhead.

The "you can find bugs by detecting illegal bit patterns" is a red
herring. You _might_ detect bugs when you find illegal bit
patterns. You might also introduce bugs by making a state
machine more complicated than it needs to be.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/