debugfs: Use the hash_version from superblock if a file system is opened
The debugfs program's dx_hash command computes the hash for the given
filename, taking the hash_seed and hash_version (i.e hash algorithm)
as arguments. So the user has to refer to the superblock to get these
values used by the filesystem. So if debugfs has an opened file
system, use those values from the current file system.
[ Fixed patch to avoid crashing when a file system is not opened. --TYT ]
Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
Link: https://lore.kernel.org/r/20230824065634.2662858-1-srivathsa.d.dara@oracle.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>