Whamcloud - gitweb
mke2fs: Allow the default hash algorithm in mke2fs.conf
authorTheodore Ts'o <tytso@mit.edu>
Sat, 30 Aug 2008 01:39:36 +0000 (21:39 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 30 Aug 2008 01:39:36 +0000 (21:39 -0400)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
misc/mke2fs.c
misc/mke2fs.conf.5.in

index 70ff889..1dd7e8a 100644 (file)
@@ -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);
 
        /*
index 04bffc5..692afc6 100644 (file)
@@ -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.