adam900710 btrfs-progs: Output proper csum string if csum mismatch
841472b Jan 20, 2020
btrfs-progs: Output proper csum string if csum mismatch
Introduce a new helper, csum_to_string(), to convert binary csum to
string.

And use it in check_extent_csums(), so that
"btrfs check --check-data-csum" could report the following human
readable output:
  mirror 1 bytenr 13631488 csum 0x13fec125 expected csum 0x98757625

Other than the original octane one:
  mirror 1 bytenr 13631488 csum 19 expected csum 152

It also has the extra handling for 32 bytes csum (e.g. SHA256).
For such long csum, it needs 66 characters (+2 for "0x") to just output
one hash, so this function would truncate them into the following
format:
 0xaabb...ccdd
    |       \- The tailing 2 bytes
    \--------- The leading 2 bytes

Although this means it's possible to hit cases where both result and
expected csum look the same, but it should be rare since small change in
cryptographic should lead to completely different output.

Signed-off-by: Qu Wenruo <wqu@suse.com>
841472b