Commit 32051906 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20220303111905.321089-7-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 20072ec8
......@@ -1163,17 +1163,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment