From d5f57d9553d4c855e282dbd3edf1ad85ab716d33 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 29 Aug 2008 21:39:36 -0400 Subject: [PATCH] mke2fs: Allow the default hash algorithm in mke2fs.conf Signed-off-by: "Theodore Ts'o" --- misc/mke2fs.c | 9 +++++++-- misc/mke2fs.conf.5.in | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 70ff889..1dd7e8a 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -1825,9 +1825,10 @@ int main (int argc, char *argv[]) badblocks_list bb_list = 0; unsigned int journal_blocks; unsigned int i; - int val; + int val, hash_alg; io_manager io_ptr; char tdb_string[40]; + char *hash_alg_str; #ifdef ENABLE_NLS setlocale(LC_MESSAGES, ""); @@ -1880,7 +1881,11 @@ int main (int argc, char *argv[]) /* * Initialize the directory index variables */ - fs->super->s_def_hash_version = EXT2_HASH_HALF_MD4; + hash_alg_str = get_string_from_profile(fs_types, "hash_alg", + "half_md4"); + hash_alg = e2p_string2hash(hash_alg_str); + fs->super->s_def_hash_version = (hash_alg >= 0) ? hash_alg : + EXT2_HASH_HALF_MD4; uuid_generate((unsigned char *) fs->super->s_hash_seed); /* diff --git a/misc/mke2fs.conf.5.in b/misc/mke2fs.conf.5.in index 04bffc5..692afc6 100644 --- a/misc/mke2fs.conf.5.in +++ b/misc/mke2fs.conf.5.in @@ -136,6 +136,15 @@ This relation specifies the default blocksize if the user does not specify a blocksize on the command line, and the filesystem-type specific section of the configuration file does not specify a blocksize. .TP +.I hash_alg +This relation specifies the default hash algorithm used for the +new filesystems with hashed b-tree directories. Valid algorithms +accepted are: +.IR legacy , +.IR half_md4 , +and +.IR tea . +.TP .I inode_ratio This relation specifies the default inode ratio if the user does not specify one on the command line, and the filesystem-type @@ -318,6 +327,15 @@ specify one on the command line. This relation specifies the default inode size if the user does not specify one on the command line. .TP +.I hash_alg +This relation specifies the default hash algorithm used for the +new filesystems with hashed b-tree directories. Valid algorithms +accepted are: +.IR legacy , +.IR half_md4 , +and +.IR tea . +.TP .I flex_bg_size This relation specifies the number of block goups that will be packed together to create one large virtual block group on an ext4 filesystem. -- 1.8.3.1