aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/namei.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2008-10-28 13:21:44 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-10-28 13:21:44 -0400
commitf99b25897a86fcfff9140396a97261ae65fed872 (patch)
tree2191505f190d09ff31896487c73b8187cb475596 /fs/ext4/namei.c
parent5e1f8c9e20a92743eefc9a82c2db835213905e26 (diff)
ext4: 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>
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r--fs/ext4/namei.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 9fd2a5e1be4d..315858db8078 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -372,6 +372,8 @@ dx_probe(const struct qstr *d_name, struct inode *dir,
372 goto fail; 372 goto fail;
373 } 373 }
374 hinfo->hash_version = root->info.hash_version; 374 hinfo->hash_version = root->info.hash_version;
375 if (hinfo->hash_version <= DX_HASH_TEA)
376 hinfo->hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned;
375 hinfo->seed = EXT4_SB(dir->i_sb)->s_hash_seed; 377 hinfo->seed = EXT4_SB(dir->i_sb)->s_hash_seed;
376 if (d_name) 378 if (d_name)
377 ext4fs_dirhash(d_name->name, d_name->len, hinfo); 379 ext4fs_dirhash(d_name->name, d_name->len, hinfo);
@@ -641,6 +643,9 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
641 dir = dir_file->f_path.dentry->d_inode; 643 dir = dir_file->f_path.dentry->d_inode;
642 if (!(EXT4_I(dir)->i_flags & EXT4_INDEX_FL)) { 644 if (!(EXT4_I(dir)->i_flags & EXT4_INDEX_FL)) {
643 hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version; 645 hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
646 if (hinfo.hash_version <= DX_HASH_TEA)
647 hinfo.hash_version +=
648 EXT4_SB(dir->i_sb)->s_hash_unsigned;
644 hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; 649 hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed;
645 count = htree_dirblock_to_tree(dir_file, dir, 0, &hinfo, 650 count = htree_dirblock_to_tree(dir_file, dir, 0, &hinfo,
646 start_hash, start_minor_hash); 651 start_hash, start_minor_hash);
@@ -1408,6 +1413,8 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1408 1413
1409 /* Initialize as for dx_probe */ 1414 /* Initialize as for dx_probe */
1410 hinfo.hash_version = root->info.hash_version; 1415 hinfo.hash_version = root->info.hash_version;
1416 if (hinfo.hash_version <= DX_HASH_TEA)
1417 hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned;
1411 hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; 1418 hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed;
1412 ext4fs_dirhash(name, namelen, &hinfo); 1419 ext4fs_dirhash(name, namelen, &hinfo);
1413 frame = frames; 1420 frame = frames;