summaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorCarlos Maiolino <cmaiolino@redhat.com>2012-12-10 16:30:45 -0500
committerTheodore Ts'o <tytso@mit.edu>2012-12-10 16:30:45 -0500
commit9a4c8019471386c6fb039ae9e30f5216b6b55a9e (patch)
treedf7b86c60e1f32f793d85438f67e3c9f23ec165a /fs/ext4/super.c
parent939da1084458246d2e29dd921c2012c177000e96 (diff)
ext4: ensure Inode flags consistency are checked at build time
Flags being used by atomic operations in inode flags (e.g. ext4_test_inode_flag(), should be consistent with that actually stored in inodes, i.e.: EXT4_XXX_FL. It ensures that this consistency is checked at build-time, not at run-time. Currently, the flags consistency are being checked at run-time, but, there is no real reason to not do a build-time check instead of a run-time check. The code is comparing macro defined values with enum type variables, where both are constants, so, there is no problem in comparing constants at build-time. enum variables are treated as constants by the C compiler, according to the C99 specs (see www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf sec. 6.2.5, item 16), so, there is no real problem in comparing an enumeration type at build time Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 7d53adff8bd..3cdb0a2fc64 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5278,6 +5278,7 @@ static int __init ext4_init_fs(void)
ext4_li_info = NULL;
mutex_init(&ext4_li_mtx);
+ /* Build-time check for flags consistency */
ext4_check_flag_values();
for (i = 0; i < EXT4_WQ_HASH_SZ; i++) {