]> www.infradead.org Git - users/hch/block.git/commitdiff
nvdimm-btt: use bvec_kmap_local in btt_rw_integrity
authorChristoph Hellwig <hch@lst.de>
Thu, 20 May 2021 13:00:22 +0000 (15:00 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 21 May 2021 05:55:29 +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/nvdimm/btt.c

index 18a267d5073f98fc4f47257702b09c46e353be2c..0d61d9f5803fabcce30a57d7cf22350d200c70e4 100644 (file)
@@ -1164,17 +1164,15 @@ static int btt_rw_integrity(struct btt *btt, struct bio_integrity_payload *bip,
                 */
 
                cur_len = min(len, bv.bv_len);
-               mem = kmap_atomic(bv.bv_page);
+               mem = bvec_kmap_local(&bv);
                if (rw)
-                       ret = arena_write_bytes(arena, meta_nsoff,
-                                       mem + bv.bv_offset, cur_len,
+                       ret = arena_write_bytes(arena, meta_nsoff, mem, cur_len,
                                        NVDIMM_IO_ATOMIC);
                else
-                       ret = arena_read_bytes(arena, meta_nsoff,
-                                       mem + bv.bv_offset, cur_len,
+                       ret = arena_read_bytes(arena, meta_nsoff, mem, cur_len,
                                        NVDIMM_IO_ATOMIC);
 
-               kunmap_atomic(mem);
+               kunmap_local(mem);
                if (ret)
                        return ret;