From: Theodore Ts'o Date: Tue, 16 Jan 2024 02:59:49 +0000 (-0500) Subject: debugfs: dx_hash: honor the unsigned hash flag if a file system is opened X-Git-Tag: v1.47.1-rc1~73 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=1094c175940d38013dd87145c18169f04530c978;p=tools%2Fe2fsprogs.git debugfs: dx_hash: honor the unsigned hash flag if a file system is opened 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 --- diff --git a/debugfs/htree.c b/debugfs/htree.c index fab04e2..73a68e9 100644 --- a/debugfs/htree.c +++ b/debugfs/htree.c @@ -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();