Commit 352ae07b authored by David Sterba's avatar David Sterba

btrfs: add blake2b to checksumming algorithms

Add blake2b (with 256 bit digest) to the list of possible checksumming
algorithms used by BTRFS.
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b4e967be
...@@ -37,6 +37,8 @@ static const struct btrfs_csums { ...@@ -37,6 +37,8 @@ static const struct btrfs_csums {
[BTRFS_CSUM_TYPE_CRC32] = { .size = 4, .name = "crc32c" }, [BTRFS_CSUM_TYPE_CRC32] = { .size = 4, .name = "crc32c" },
[BTRFS_CSUM_TYPE_XXHASH] = { .size = 8, .name = "xxhash64" }, [BTRFS_CSUM_TYPE_XXHASH] = { .size = 8, .name = "xxhash64" },
[BTRFS_CSUM_TYPE_SHA256] = { .size = 32, .name = "sha256" }, [BTRFS_CSUM_TYPE_SHA256] = { .size = 32, .name = "sha256" },
[BTRFS_CSUM_TYPE_BLAKE2] = { .size = 32, .name = "blake2b",
.driver = "blake2b-256" },
}; };
int btrfs_super_csum_size(const struct btrfs_super_block *s) int btrfs_super_csum_size(const struct btrfs_super_block *s)
......
...@@ -354,6 +354,7 @@ static bool btrfs_supported_super_csum(u16 csum_type) ...@@ -354,6 +354,7 @@ static bool btrfs_supported_super_csum(u16 csum_type)
case BTRFS_CSUM_TYPE_CRC32: case BTRFS_CSUM_TYPE_CRC32:
case BTRFS_CSUM_TYPE_XXHASH: case BTRFS_CSUM_TYPE_XXHASH:
case BTRFS_CSUM_TYPE_SHA256: case BTRFS_CSUM_TYPE_SHA256:
case BTRFS_CSUM_TYPE_BLAKE2:
return true; return true;
default: default:
return false; return false;
......
...@@ -2464,3 +2464,4 @@ MODULE_LICENSE("GPL"); ...@@ -2464,3 +2464,4 @@ MODULE_LICENSE("GPL");
MODULE_SOFTDEP("pre: crc32c"); MODULE_SOFTDEP("pre: crc32c");
MODULE_SOFTDEP("pre: xxhash64"); MODULE_SOFTDEP("pre: xxhash64");
MODULE_SOFTDEP("pre: sha256"); MODULE_SOFTDEP("pre: sha256");
MODULE_SOFTDEP("pre: blake2b-256");
...@@ -304,6 +304,7 @@ enum btrfs_csum_type { ...@@ -304,6 +304,7 @@ enum btrfs_csum_type {
BTRFS_CSUM_TYPE_CRC32 = 0, BTRFS_CSUM_TYPE_CRC32 = 0,
BTRFS_CSUM_TYPE_XXHASH = 1, BTRFS_CSUM_TYPE_XXHASH = 1,
BTRFS_CSUM_TYPE_SHA256 = 2, BTRFS_CSUM_TYPE_SHA256 = 2,
BTRFS_CSUM_TYPE_BLAKE2 = 3,
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment