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

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.de


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 07fee7ab
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -326,9 +326,9 @@ void drbd_csum_bio(struct crypto_shash *tfm, struct bio *bio, void *digest)
	bio_for_each_segment(bvec, bio, iter) {
		u8 *src;

		src = kmap_atomic(bvec.bv_page);
		crypto_shash_update(desc, src + bvec.bv_offset, bvec.bv_len);
		kunmap_atomic(src);
		src = bvec_kmap_local(&bvec);
		crypto_shash_update(desc, src, bvec.bv_len);
		kunmap_local(src);

		/* REQ_OP_WRITE_SAME has only one segment,
		 * checksum the payload only once. */