OSDN Git Service

dm integrity: use bvec_kmap_local in integrity_metadata
authorChristoph Hellwig <hch@lst.de>
Tue, 19 Oct 2021 13:44:03 +0000 (15:44 +0200)
committerMike Snitzer <snitzer@redhat.com>
Mon, 1 Nov 2021 17:28:45 +0000 (13:28 -0400)
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>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-integrity.c

index dd78baf..d8180d2 100644 (file)
@@ -1770,7 +1770,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 {
@@ -1780,7 +1780,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);