]> www.infradead.org Git - users/hch/block.git/commitdiff
dm-integrity: use bvec_kmap_local in integrity_metadata
authorChristoph Hellwig <hch@lst.de>
Thu, 20 May 2021 12:52:10 +0000 (14:52 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 21 May 2021 05:55:28 +0000 (07:55 +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/md/dm-integrity.c

index 781942aeddd153f4ec3591194be9a143712783a6..674b831f4c6ad7b929f9cf1dc03c5a2849a96b75 100644 (file)
@@ -1765,7 +1765,7 @@ static void integrity_metadata(struct work_struct *w)
                        char *mem, *checksums_ptr;
 
 again:
-                       mem = (char *)kmap_atomic(bv.bv_page) + bv.bv_offset;
+                       mem = bvec_kmap_local(&bv);
                        pos = 0;
                        checksums_ptr = checksums;
                        do {
@@ -1775,7 +1775,7 @@ again:
                                pos += ic->sectors_per_block << SECTOR_SHIFT;
                                sector += ic->sectors_per_block;
                        } while (pos < bv.bv_len && sectors_to_process && checksums != checksums_onstack);
-                       kunmap_atomic(mem);
+                       kunmap_local(mem);
 
                        r = dm_integrity_rw_tag(ic, checksums, &dio->metadata_block, &dio->metadata_offset,
                                                checksums_ptr - checksums, dio->op == REQ_OP_READ ? TAG_CMP : TAG_WRITE);