diff options
Diffstat (limited to 'fs/btrfs/check-integrity.c')
-rw-r--r-- | fs/btrfs/check-integrity.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 131d82800b3a..0e8388e72d8d 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c | |||
@@ -92,11 +92,11 @@ | |||
92 | #include <linux/slab.h> | 92 | #include <linux/slab.h> |
93 | #include <linux/buffer_head.h> | 93 | #include <linux/buffer_head.h> |
94 | #include <linux/mutex.h> | 94 | #include <linux/mutex.h> |
95 | #include <linux/crc32c.h> | ||
96 | #include <linux/genhd.h> | 95 | #include <linux/genhd.h> |
97 | #include <linux/blkdev.h> | 96 | #include <linux/blkdev.h> |
98 | #include "ctree.h" | 97 | #include "ctree.h" |
99 | #include "disk-io.h" | 98 | #include "disk-io.h" |
99 | #include "hash.h" | ||
100 | #include "transaction.h" | 100 | #include "transaction.h" |
101 | #include "extent_io.h" | 101 | #include "extent_io.h" |
102 | #include "volumes.h" | 102 | #include "volumes.h" |
@@ -1456,10 +1456,14 @@ static int btrfsic_handle_extent_data( | |||
1456 | btrfsic_read_from_block_data(block_ctx, &file_extent_item, | 1456 | btrfsic_read_from_block_data(block_ctx, &file_extent_item, |
1457 | file_extent_item_offset, | 1457 | file_extent_item_offset, |
1458 | sizeof(struct btrfs_file_extent_item)); | 1458 | sizeof(struct btrfs_file_extent_item)); |
1459 | next_bytenr = btrfs_stack_file_extent_disk_bytenr(&file_extent_item) + | 1459 | next_bytenr = btrfs_stack_file_extent_disk_bytenr(&file_extent_item); |
1460 | btrfs_stack_file_extent_offset(&file_extent_item); | 1460 | if (btrfs_stack_file_extent_compression(&file_extent_item) == |
1461 | generation = btrfs_stack_file_extent_generation(&file_extent_item); | 1461 | BTRFS_COMPRESS_NONE) { |
1462 | num_bytes = btrfs_stack_file_extent_num_bytes(&file_extent_item); | 1462 | next_bytenr += btrfs_stack_file_extent_offset(&file_extent_item); |
1463 | num_bytes = btrfs_stack_file_extent_num_bytes(&file_extent_item); | ||
1464 | } else { | ||
1465 | num_bytes = btrfs_stack_file_extent_disk_num_bytes(&file_extent_item); | ||
1466 | } | ||
1463 | generation = btrfs_stack_file_extent_generation(&file_extent_item); | 1467 | generation = btrfs_stack_file_extent_generation(&file_extent_item); |
1464 | 1468 | ||
1465 | if (state->print_mask & BTRFSIC_PRINT_MASK_VERY_VERBOSE) | 1469 | if (state->print_mask & BTRFSIC_PRINT_MASK_VERY_VERBOSE) |
@@ -1695,7 +1699,7 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
1695 | return -1; | 1699 | return -1; |
1696 | } | 1700 | } |
1697 | bio->bi_bdev = block_ctx->dev->bdev; | 1701 | bio->bi_bdev = block_ctx->dev->bdev; |
1698 | bio->bi_sector = dev_bytenr >> 9; | 1702 | bio->bi_iter.bi_sector = dev_bytenr >> 9; |
1699 | 1703 | ||
1700 | for (j = i; j < num_pages; j++) { | 1704 | for (j = i; j < num_pages; j++) { |
1701 | ret = bio_add_page(bio, block_ctx->pagev[j], | 1705 | ret = bio_add_page(bio, block_ctx->pagev[j], |
@@ -1819,7 +1823,7 @@ static int btrfsic_test_for_metadata(struct btrfsic_state *state, | |||
1819 | size_t sublen = i ? PAGE_CACHE_SIZE : | 1823 | size_t sublen = i ? PAGE_CACHE_SIZE : |
1820 | (PAGE_CACHE_SIZE - BTRFS_CSUM_SIZE); | 1824 | (PAGE_CACHE_SIZE - BTRFS_CSUM_SIZE); |
1821 | 1825 | ||
1822 | crc = crc32c(crc, data, sublen); | 1826 | crc = btrfs_crc32c(crc, data, sublen); |
1823 | } | 1827 | } |
1824 | btrfs_csum_final(crc, csum); | 1828 | btrfs_csum_final(crc, csum); |
1825 | if (memcmp(csum, h->csum, state->csum_size)) | 1829 | if (memcmp(csum, h->csum, state->csum_size)) |
@@ -3013,7 +3017,7 @@ static void __btrfsic_submit_bio(int rw, struct bio *bio) | |||
3013 | int bio_is_patched; | 3017 | int bio_is_patched; |
3014 | char **mapped_datav; | 3018 | char **mapped_datav; |
3015 | 3019 | ||
3016 | dev_bytenr = 512 * bio->bi_sector; | 3020 | dev_bytenr = 512 * bio->bi_iter.bi_sector; |
3017 | bio_is_patched = 0; | 3021 | bio_is_patched = 0; |
3018 | if (dev_state->state->print_mask & | 3022 | if (dev_state->state->print_mask & |
3019 | BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) | 3023 | BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) |
@@ -3021,8 +3025,8 @@ static void __btrfsic_submit_bio(int rw, struct bio *bio) | |||
3021 | "submit_bio(rw=0x%x, bi_vcnt=%u," | 3025 | "submit_bio(rw=0x%x, bi_vcnt=%u," |
3022 | " bi_sector=%llu (bytenr %llu), bi_bdev=%p)\n", | 3026 | " bi_sector=%llu (bytenr %llu), bi_bdev=%p)\n", |
3023 | rw, bio->bi_vcnt, | 3027 | rw, bio->bi_vcnt, |
3024 | (unsigned long long)bio->bi_sector, dev_bytenr, | 3028 | (unsigned long long)bio->bi_iter.bi_sector, |
3025 | bio->bi_bdev); | 3029 | dev_bytenr, bio->bi_bdev); |
3026 | 3030 | ||
3027 | mapped_datav = kmalloc(sizeof(*mapped_datav) * bio->bi_vcnt, | 3031 | mapped_datav = kmalloc(sizeof(*mapped_datav) * bio->bi_vcnt, |
3028 | GFP_NOFS); | 3032 | GFP_NOFS); |