Commit 503469b5 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: use bvec_kmap_local in bio_integrity_process

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 avatarMartin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20210727055646.118787-16-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8aec120a
...@@ -172,18 +172,16 @@ static blk_status_t bio_integrity_process(struct bio *bio, ...@@ -172,18 +172,16 @@ static blk_status_t bio_integrity_process(struct bio *bio,
iter.prot_buf = prot_buf; iter.prot_buf = prot_buf;
__bio_for_each_segment(bv, bio, bviter, *proc_iter) { __bio_for_each_segment(bv, bio, bviter, *proc_iter) {
void *kaddr = kmap_atomic(bv.bv_page); void *kaddr = bvec_kmap_local(&bv);
iter.data_buf = kaddr + bv.bv_offset; iter.data_buf = kaddr;
iter.data_size = bv.bv_len; iter.data_size = bv.bv_len;
ret = proc_fn(&iter); ret = proc_fn(&iter);
if (ret) { kunmap_local(kaddr);
kunmap_atomic(kaddr);
return ret; if (ret)
} break;
kunmap_atomic(kaddr);
} }
return 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