Skip to content

Commit 3205190

Browse files
Christoph Hellwigaxboe
authored andcommitted
nvdimm-btt: use bvec_kmap_local in btt_rw_integrity
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> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Link: https://lore.kernel.org/r/20220303111905.321089-7-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 20072ec commit 3205190

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

drivers/nvdimm/btt.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,17 +1163,15 @@ static int btt_rw_integrity(struct btt *btt, struct bio_integrity_payload *bip,
11631163
*/
11641164

11651165
cur_len = min(len, bv.bv_len);
1166-
mem = kmap_atomic(bv.bv_page);
1166+
mem = bvec_kmap_local(&bv);
11671167
if (rw)
1168-
ret = arena_write_bytes(arena, meta_nsoff,
1169-
mem + bv.bv_offset, cur_len,
1168+
ret = arena_write_bytes(arena, meta_nsoff, mem, cur_len,
11701169
NVDIMM_IO_ATOMIC);
11711170
else
1172-
ret = arena_read_bytes(arena, meta_nsoff,
1173-
mem + bv.bv_offset, cur_len,
1171+
ret = arena_read_bytes(arena, meta_nsoff, mem, cur_len,
11741172
NVDIMM_IO_ATOMIC);
11751173

1176-
kunmap_atomic(mem);
1174+
kunmap_local(mem);
11771175
if (ret)
11781176
return ret;
11791177

0 commit comments

Comments
 (0)