--- linux-2.4.19-pre6.o/fs/reiserfs/super.c	Mon Apr  8 14:53:24 2002
+++ linux-2.4.19-pre6/fs/reiserfs/super.c	Mon Apr 15 12:34:26 2002
@@ -793,10 +793,10 @@
 // hash detection stuff
 
 
-// if root directory is empty - we set default - Yura's - hash and
-// warn about it
+// if root directory is empty and no hash hint were supplied - we set 
+// default - r5 hash - (Rupasov's Hash Number 5) and warn about it.
 // FIXME: we look for only one name in a directory. If tea and yura
-// bith have the same value - we ask user to send report to the
+// both have the same value - we ask user to send report to the
 // mailing list
 __u32 find_hash_out (struct super_block * s)
 {
@@ -822,12 +822,19 @@
 	    de.de_entry_num --;
 	set_de_name_and_namelen (&de);
 	if (deh_offset( &(de.de_deh[de.de_entry_num]) ) == DOT_DOT_OFFSET) {
-	    /* allow override in this case */
-	    if (reiserfs_rupasov_hash(s)) {
-		hash = YURA_HASH ;
+	    if ( reiserfs_hash_detect(s) ) { // Hash hint was supplied
+	        if (reiserfs_rupasov_hash(s)) {
+		    hash = YURA_HASH ;
+		} else if (reiserfs_tea_hash(s)) {
+		    hash = TEA_HASH ;
+		} else if (reiserfs_r5_hash(s)) {
+		    hash = R5_HASH ;
+		}
+	    } 
+	    if (!(s->u.reiserfs_sb.s_mount_opt & (1<<FORCE_RUPASOV_HASH|1<<FORCE_TEA_HASH|1<<FORCE_R5_HASH)) ) { // we need this for hash=detect case
+		reiserfs_warning("reiserfs: FS seems to be empty, autodetect "
+				 "is using the default %s hash\n", reiserfs_hashname(hash));
 	    }
-	    reiserfs_warning("reiserfs: FS seems to be empty, autodetect "
-	                     "is using the default hash\n");
 	    break;
 	}
 	r5hash=GET_HASH_VALUE (r5_hash (de.de_name, de.de_namelen));
