]> www.infradead.org Git - users/hch/block.git/commitdiff
drbd: use bvec_kmap_local in drbd_csum_bio
authorChristoph Hellwig <hch@lst.de>
Thu, 20 May 2021 13:12:05 +0000 (15:12 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 21 May 2021 05:57:23 +0000 (07:57 +0200)
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>
drivers/block/drbd/drbd_worker.c

index 64563bfdf0da02b1c2eb3b709d59ac3157e599da..f5f5ee80c18afc7bceeb91e500785575dad3c306 100644 (file)
@@ -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. */