Commit 47227850 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

drbd: use bvec_kmap_local in drbd_csum_bio

Using local kmaps slightly reduces the chances to stray writes, and
the bvec interface cleans up the code a little bit.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20220303111905.321089-9-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 07fee7ab
...@@ -326,9 +326,9 @@ void drbd_csum_bio(struct crypto_shash *tfm, struct bio *bio, void *digest) ...@@ -326,9 +326,9 @@ void drbd_csum_bio(struct crypto_shash *tfm, struct bio *bio, void *digest)
bio_for_each_segment(bvec, bio, iter) { bio_for_each_segment(bvec, bio, iter) {
u8 *src; u8 *src;
src = kmap_atomic(bvec.bv_page); src = bvec_kmap_local(&bvec);
crypto_shash_update(desc, src + bvec.bv_offset, bvec.bv_len); crypto_shash_update(desc, src, bvec.bv_len);
kunmap_atomic(src); kunmap_local(src);
/* REQ_OP_WRITE_SAME has only one segment, /* REQ_OP_WRITE_SAME has only one segment,
* checksum the payload only once. */ * checksum the payload only once. */
......
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