diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-10-28 13:21:55 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-10-28 13:21:55 -0400 |
commit | 5e1f8c9e20a92743eefc9a82c2db835213905e26 (patch) | |
tree | 0c945d1e31b87d1d8c18381f4ffe99122ddb797b /fs/ext3/super.c | |
parent | 8f72fbdf0d92e6127583cc548bf043c60cd4720f (diff) |
ext3: Add support for non-native signed/unsigned htree hash algorithms
The original ext3 hash algorithms assumed that variables of type char
were signed, as God and K&R intended. Unfortunately, this assumption
is not true on some architectures. Userspace support for marking
filesystems with non-native signed/unsigned chars was added two years
ago, but the kernel-side support was never added (until now).
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Diffstat (limited to 'fs/ext3/super.c')
-rw-r--r-- | fs/ext3/super.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index f6c94f232ec1..541d5e4f7f6e 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -1744,6 +1744,18 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1744 | for (i=0; i < 4; i++) | 1744 | for (i=0; i < 4; i++) |
1745 | sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); | 1745 | sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); |
1746 | sbi->s_def_hash_version = es->s_def_hash_version; | 1746 | sbi->s_def_hash_version = es->s_def_hash_version; |
1747 | i = le32_to_cpu(es->s_flags); | ||
1748 | if (i & EXT2_FLAGS_UNSIGNED_HASH) | ||
1749 | sbi->s_hash_unsigned = 3; | ||
1750 | else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { | ||
1751 | #ifdef __CHAR_UNSIGNED__ | ||
1752 | es->s_flags |= cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); | ||
1753 | sbi->s_hash_unsigned = 3; | ||
1754 | #else | ||
1755 | es->s_flags |= cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); | ||
1756 | #endif | ||
1757 | sb->s_dirt = 1; | ||
1758 | } | ||
1747 | 1759 | ||
1748 | if (sbi->s_blocks_per_group > blocksize * 8) { | 1760 | if (sbi->s_blocks_per_group > blocksize * 8) { |
1749 | printk (KERN_ERR | 1761 | printk (KERN_ERR |