Skip to content

Commit

Permalink
block: use bvec_kmap_local in bio_integrity_process
Browse files Browse the repository at this point in the history
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]>
Reviewed-by: Martin K. Petersen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Aug 2, 2021
1 parent 8aec120 commit 503469b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions block/bio-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,16 @@ static blk_status_t bio_integrity_process(struct bio *bio,
iter.prot_buf = prot_buf;

__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;

ret = proc_fn(&iter);
if (ret) {
kunmap_atomic(kaddr);
return ret;
}
kunmap_local(kaddr);

if (ret)
break;

kunmap_atomic(kaddr);
}
return ret;
}
Expand Down

0 comments on commit 503469b

Please sign in to comment.