[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110109145838.GA3346@thunk.org>
Date: Sun, 9 Jan 2011 09:58:38 -0500
From: Ted Ts'o <tytso@....edu>
To: Rogier Wolff <R.E.Wolff@...wizard.nl>
Cc: Amir Goldstein <amir73il@...il.com>,
Ric Wheeler <rwheeler@...hat.com>,
Con Kolivas <kernel@...ivas.org>, adilger.kernel@...ger.ca,
linux-ext4@...r.kernel.org
Subject: Re: Regular ext4 error warning with HD in USB dock
On Sun, Jan 09, 2011 at 09:12:49AM +0100, Rogier Wolff wrote:
> > No. The superblock nor its offset will never change. It's like the
> > syscall ABI, only worse. If we changed it would break *everybody*.
> > Fortunately there is a huge amount of space left over in the 1024 byte
> > superblock.
>
> It's called defensive programming. It prevents bugs before they
> happen. By your reasoning you could've written 2048 or 0x800 there.
Defensive programming would be something like
BUG_ON(sizeof(struct ext4_super_block) != 1024);
(unfortunately #error sizeof(struct ext4_super_block) != 1024 won't
work since #error is handled by the preprocessor, and I don't think we
can trigger a compile-time warning for a structure size issue).
We could add that, if people like. I do have regression tests (i.e.,
boot a system with ext4) which would die if anything like that
changed, though.
And yes, I have similar regression tests in e2fsprogs that would
trigger if the superblock size were to ever change.
- Ted
P.S. The only way I can think of to do it at compile time would be to
build a test .o file with -g, and then use a program like pahole that
pulls the information out of the DWARF information. Might actually be
a good thing to do that, since it could also be useful for automating
searches for unoptimize structures. Unfortunately, many developers
don't have the DWARF utilities installed, so that would add a
dependency on the kernel build.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists