aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/namei.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2008-10-28 13:21:55 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-10-28 13:21:55 -0400
commit5e1f8c9e20a92743eefc9a82c2db835213905e26 (patch)
tree0c945d1e31b87d1d8c18381f4ffe99122ddb797b /fs/ext3/namei.c
parent8f72fbdf0d92e6127583cc548bf043c60cd4720f (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/namei.c')
-rw-r--r--fs/ext3/namei.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 1dd2abe6313e..287b304d42a7 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -368,6 +368,8 @@ dx_probe(struct qstr *entry, struct inode *dir,
368 goto fail; 368 goto fail;
369 } 369 }
370 hinfo->hash_version = root->info.hash_version; 370 hinfo->hash_version = root->info.hash_version;
371 if (hinfo->hash_version <= DX_HASH_TEA)
372 hinfo->hash_version += EXT3_SB(dir->i_sb)->s_hash_unsigned;
371 hinfo->seed = EXT3_SB(dir->i_sb)->s_hash_seed; 373 hinfo->seed = EXT3_SB(dir->i_sb)->s_hash_seed;
372 if (entry) 374 if (entry)
373 ext3fs_dirhash(entry->name, entry->len, hinfo); 375 ext3fs_dirhash(entry->name, entry->len, hinfo);
@@ -636,6 +638,9 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
636 dir = dir_file->f_path.dentry->d_inode; 638 dir = dir_file->f_path.dentry->d_inode;
637 if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) { 639 if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) {
638 hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; 640 hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version;
641 if (hinfo.hash_version <= DX_HASH_TEA)
642 hinfo.hash_version +=
643 EXT3_SB(dir->i_sb)->s_hash_unsigned;
639 hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed; 644 hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed;
640 count = htree_dirblock_to_tree(dir_file, dir, 0, &hinfo, 645 count = htree_dirblock_to_tree(dir_file, dir, 0, &hinfo,
641 start_hash, start_minor_hash); 646 start_hash, start_minor_hash);
@@ -1398,6 +1403,8 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1398 1403
1399 /* Initialize as for dx_probe */ 1404 /* Initialize as for dx_probe */
1400 hinfo.hash_version = root->info.hash_version; 1405 hinfo.hash_version = root->info.hash_version;
1406 if (hinfo.hash_version <= DX_HASH_TEA)
1407 hinfo.hash_version += EXT3_SB(dir->i_sb)->s_hash_unsigned;
1401 hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed; 1408 hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed;
1402 ext3fs_dirhash(name, namelen, &hinfo); 1409 ext3fs_dirhash(name, namelen, &hinfo);
1403 frame = frames; 1410 frame = frames;