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:

committed by
David Sterba

parent
1ed802c972
commit
fd08001f17
@@ -2742,9 +2742,7 @@ static int check_data_csum(struct inode *inode, struct btrfs_io_bio *io_bio,
|
||||
kaddr = kmap_atomic(page);
|
||||
shash->tfm = fs_info->csum_shash;
|
||||
|
||||
crypto_shash_init(shash);
|
||||
crypto_shash_update(shash, kaddr + pgoff, len);
|
||||
crypto_shash_final(shash, csum);
|
||||
crypto_shash_digest(shash, kaddr + pgoff, len, csum);
|
||||
|
||||
if (memcmp(csum, csum_expected, csum_size))
|
||||
goto zeroit;
|
||||
|
Reference in New Issue
Block a user