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 <[email protected]>
---
 drivers/md/dm-integrity.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index dc03b70f6e65c..77c1f645f8438 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -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 @@ static void integrity_metadata(struct work_struct *w)
                                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);
-- 
2.30.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to