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
@@ -601,13 +601,12 @@ blk_status_t btrfs_csum_one_bio(struct inode *inode, struct bio *bio,
|
||||
index = 0;
|
||||
}
|
||||
|
||||
crypto_shash_init(shash);
|
||||
data = kmap_atomic(bvec.bv_page);
|
||||
crypto_shash_update(shash, data + bvec.bv_offset
|
||||
crypto_shash_digest(shash, data + bvec.bv_offset
|
||||
+ (i * fs_info->sectorsize),
|
||||
fs_info->sectorsize);
|
||||
fs_info->sectorsize,
|
||||
sums->sums + index);
|
||||
kunmap_atomic(data);
|
||||
crypto_shash_final(shash, (char *)(sums->sums + index));
|
||||
index += csum_size;
|
||||
offset += fs_info->sectorsize;
|
||||
this_sum_bytes += fs_info->sectorsize;
|
||||
|
Reference in New Issue
Block a user