mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
btrfs: use crypto_shash_digest() instead of open coding
Use crypto_shash_digest() instead of crypto_shash_init() + crypto_shash_update() + crypto_shash_final(). This is more efficient. Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
1ed802c972
commit
fd08001f17
4 changed files with 10 additions and 18 deletions
|
@ -194,11 +194,9 @@ static int check_compressed_csum(struct btrfs_inode *inode,
|
|||
for (i = 0; i < cb->nr_pages; i++) {
|
||||
page = cb->compressed_pages[i];
|
||||
|
||||
crypto_shash_init(shash);
|
||||
kaddr = kmap_atomic(page);
|
||||
crypto_shash_update(shash, kaddr, PAGE_SIZE);
|
||||
crypto_shash_digest(shash, kaddr, PAGE_SIZE, csum);
|
||||
kunmap_atomic(kaddr);
|
||||
crypto_shash_final(shash, (u8 *)&csum);
|
||||
|
||||
if (memcmp(&csum, cb_sum, csum_size)) {
|
||||
btrfs_print_data_csum_error(inode, disk_start,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue