Whamcloud - gitweb
debugfs: dx_hash: honor the unsigned hash flag if a file system is opened
authorTheodore Ts'o <tytso@mit.edu>
Tue, 16 Jan 2024 02:59:49 +0000 (21:59 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 16 Jan 2024 02:59:49 +0000 (21:59 -0500)
If we are using the hash seed and hash version from an open file
systenm, then we should also use the unsigned version of the hash
algorithm if the superblock as the unsigned hash flag set.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/htree.c

index fab04e2..73a68e9 100644 (file)
@@ -347,6 +347,9 @@ void do_dx_hash(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
                hash_seed[3] = current_fs->super->s_hash_seed[3];
 
                hash_version = current_fs->super->s_def_hash_version;
+               if (hash_version <= EXT2_HASH_TEA &&
+                   current_fs->super->s_flags & EXT2_FLAGS_UNSIGNED_HASH)
+                       hash_version += 3;
        }
 
        reset_getopt();