Skip to content

Commit

Permalink
btrfs: check-integrity: drop kmap/kunmap for block pages
Browse files Browse the repository at this point in the history
The pages in block_ctx have never been allocated from highmem (in
btrfsic_read_block) so the mapping is pointless and can be removed.

Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
kdave committed Aug 23, 2021
1 parent 4c2bf27 commit 5da3847
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions fs/btrfs/check-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -1509,10 +1509,8 @@ static void btrfsic_release_block_ctx(struct btrfsic_block_data_ctx *block_ctx)
/* Pages must be unmapped in reverse order */
while (num_pages > 0) {
num_pages--;
if (block_ctx->datav[num_pages]) {
kunmap_local(block_ctx->datav[num_pages]);
if (block_ctx->datav[num_pages])
block_ctx->datav[num_pages] = NULL;
}
if (block_ctx->pagev[num_pages]) {
__free_page(block_ctx->pagev[num_pages]);
block_ctx->pagev[num_pages] = NULL;
Expand Down Expand Up @@ -1589,7 +1587,7 @@ static int btrfsic_read_block(struct btrfsic_state *state,
i = j;
}
for (i = 0; i < num_pages; i++)
block_ctx->datav[i] = kmap_local_page(block_ctx->pagev[i]);
block_ctx->datav[i] = page_address(block_ctx->pagev[i]);

return block_ctx->len;
}
Expand Down Expand Up @@ -2654,7 +2652,7 @@ static void __btrfsic_submit_bio(struct bio *bio)

bio_for_each_segment(bvec, bio, iter) {
BUG_ON(bvec.bv_len != PAGE_SIZE);
mapped_datav[i] = kmap_local_page(bvec.bv_page);
mapped_datav[i] = page_address(bvec.bv_page);
i++;

if (dev_state->state->print_mask &
Expand All @@ -2667,9 +2665,6 @@ static void __btrfsic_submit_bio(struct bio *bio)
mapped_datav, segs,
bio, &bio_is_patched,
bio->bi_opf);
/* Unmap in reverse order */
for (--i; i >= 0; i--)
kunmap_local(mapped_datav[i]);
kfree(mapped_datav);
} else if (NULL != dev_state && (bio->bi_opf & REQ_PREFLUSH)) {
if (dev_state->state->print_mask &
Expand Down

0 comments on commit 5da3847

Please sign in to comment.