Commit 3e037efd authored by Ira Weiny's avatar Ira Weiny Committed by David Sterba

btrfs: integrity-checker: use kmap_local_page in __btrfsic_submit_bio

Again there is an array of pointers which must be unmapped in the correct
order.

Convert the kmap()'s to kmap_local_page() and adjust the unmapping
to work backwards through the unmapping loop.
Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 94a0b58d
...@@ -2677,7 +2677,7 @@ static void __btrfsic_submit_bio(struct bio *bio) ...@@ -2677,7 +2677,7 @@ static void __btrfsic_submit_bio(struct bio *bio)
dev_state = btrfsic_dev_state_lookup(bio->bi_bdev->bd_dev); dev_state = btrfsic_dev_state_lookup(bio->bi_bdev->bd_dev);
if (NULL != dev_state && if (NULL != dev_state &&
(bio_op(bio) == REQ_OP_WRITE) && bio_has_data(bio)) { (bio_op(bio) == REQ_OP_WRITE) && bio_has_data(bio)) {
unsigned int i = 0; int i = 0;
u64 dev_bytenr; u64 dev_bytenr;
u64 cur_bytenr; u64 cur_bytenr;
struct bio_vec bvec; struct bio_vec bvec;
...@@ -2702,7 +2702,7 @@ static void __btrfsic_submit_bio(struct bio *bio) ...@@ -2702,7 +2702,7 @@ static void __btrfsic_submit_bio(struct bio *bio)
bio_for_each_segment(bvec, bio, iter) { bio_for_each_segment(bvec, bio, iter) {
BUG_ON(bvec.bv_len != PAGE_SIZE); BUG_ON(bvec.bv_len != PAGE_SIZE);
mapped_datav[i] = kmap(bvec.bv_page); mapped_datav[i] = kmap_local_page(bvec.bv_page);
i++; i++;
if (dev_state->state->print_mask & if (dev_state->state->print_mask &
...@@ -2715,8 +2715,9 @@ static void __btrfsic_submit_bio(struct bio *bio) ...@@ -2715,8 +2715,9 @@ static void __btrfsic_submit_bio(struct bio *bio)
mapped_datav, segs, mapped_datav, segs,
bio, &bio_is_patched, bio, &bio_is_patched,
bio->bi_opf); bio->bi_opf);
bio_for_each_segment(bvec, bio, iter) /* Unmap in reverse order */
kunmap(bvec.bv_page); for (--i; i >= 0; i--)
kunmap_local(mapped_datav[i]);
kfree(mapped_datav); kfree(mapped_datav);
} else if (NULL != dev_state && (bio->bi_opf & REQ_PREFLUSH)) { } else if (NULL != dev_state && (bio->bi_opf & REQ_PREFLUSH)) {
if (dev_state->state->print_mask & if (dev_state->state->print_mask &
......
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