Skip to content

Commit 4722785

Browse files
Christoph Hellwigaxboe
authored andcommitted
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Link: https://lore.kernel.org/r/20220303111905.321089-9-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 07fee7a commit 4722785

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/block/drbd/drbd_worker.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ void drbd_csum_bio(struct crypto_shash *tfm, struct bio *bio, void *digest)
326326
bio_for_each_segment(bvec, bio, iter) {
327327
u8 *src;
328328

329-
src = kmap_atomic(bvec.bv_page);
330-
crypto_shash_update(desc, src + bvec.bv_offset, bvec.bv_len);
331-
kunmap_atomic(src);
329+
src = bvec_kmap_local(&bvec);
330+
crypto_shash_update(desc, src, bvec.bv_len);
331+
kunmap_local(src);
332332

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

0 commit comments

Comments
 (0)