aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/check-integrity.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/check-integrity.c')
-rw-r--r--fs/btrfs/check-integrity.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index e34a71b3e225..516e19d1d202 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -757,7 +757,7 @@ static int btrfsic_process_superblock(struct btrfsic_state *state,
757 BUG_ON(NULL == l); 757 BUG_ON(NULL == l);
758 758
759 ret = btrfsic_read_block(state, &tmp_next_block_ctx); 759 ret = btrfsic_read_block(state, &tmp_next_block_ctx);
760 if (ret < (int)PAGE_CACHE_SIZE) { 760 if (ret < (int)PAGE_SIZE) {
761 printk(KERN_INFO 761 printk(KERN_INFO
762 "btrfsic: read @logical %llu failed!\n", 762 "btrfsic: read @logical %llu failed!\n",
763 tmp_next_block_ctx.start); 763 tmp_next_block_ctx.start);
@@ -1231,15 +1231,15 @@ static void btrfsic_read_from_block_data(
1231 size_t offset_in_page; 1231 size_t offset_in_page;
1232 char *kaddr; 1232 char *kaddr;
1233 char *dst = (char *)dstv; 1233 char *dst = (char *)dstv;
1234 size_t start_offset = block_ctx->start & ((u64)PAGE_CACHE_SIZE - 1); 1234 size_t start_offset = block_ctx->start & ((u64)PAGE_SIZE - 1);
1235 unsigned long i = (start_offset + offset) >> PAGE_CACHE_SHIFT; 1235 unsigned long i = (start_offset + offset) >> PAGE_SHIFT;
1236 1236
1237 WARN_ON(offset + len > block_ctx->len); 1237 WARN_ON(offset + len > block_ctx->len);
1238 offset_in_page = (start_offset + offset) & (PAGE_CACHE_SIZE - 1); 1238 offset_in_page = (start_offset + offset) & (PAGE_SIZE - 1);
1239 1239
1240 while (len > 0) { 1240 while (len > 0) {
1241 cur = min(len, ((size_t)PAGE_CACHE_SIZE - offset_in_page)); 1241 cur = min(len, ((size_t)PAGE_SIZE - offset_in_page));
1242 BUG_ON(i >= DIV_ROUND_UP(block_ctx->len, PAGE_CACHE_SIZE)); 1242 BUG_ON(i >= DIV_ROUND_UP(block_ctx->len, PAGE_SIZE));
1243 kaddr = block_ctx->datav[i]; 1243 kaddr = block_ctx->datav[i];
1244 memcpy(dst, kaddr + offset_in_page, cur); 1244 memcpy(dst, kaddr + offset_in_page, cur);
1245 1245
@@ -1605,8 +1605,8 @@ static void btrfsic_release_block_ctx(struct btrfsic_block_data_ctx *block_ctx)
1605 1605
1606 BUG_ON(!block_ctx->datav); 1606 BUG_ON(!block_ctx->datav);
1607 BUG_ON(!block_ctx->pagev); 1607 BUG_ON(!block_ctx->pagev);
1608 num_pages = (block_ctx->len + (u64)PAGE_CACHE_SIZE - 1) >> 1608 num_pages = (block_ctx->len + (u64)PAGE_SIZE - 1) >>
1609 PAGE_CACHE_SHIFT; 1609 PAGE_SHIFT;
1610 while (num_pages > 0) { 1610 while (num_pages > 0) {
1611 num_pages--; 1611 num_pages--;
1612 if (block_ctx->datav[num_pages]) { 1612 if (block_ctx->datav[num_pages]) {
@@ -1637,15 +1637,15 @@ static int btrfsic_read_block(struct btrfsic_state *state,
1637 BUG_ON(block_ctx->datav); 1637 BUG_ON(block_ctx->datav);
1638 BUG_ON(block_ctx->pagev); 1638 BUG_ON(block_ctx->pagev);
1639 BUG_ON(block_ctx->mem_to_free); 1639 BUG_ON(block_ctx->mem_to_free);
1640 if (block_ctx->dev_bytenr & ((u64)PAGE_CACHE_SIZE - 1)) { 1640 if (block_ctx->dev_bytenr & ((u64)PAGE_SIZE - 1)) {
1641 printk(KERN_INFO 1641 printk(KERN_INFO
1642 "btrfsic: read_block() with unaligned bytenr %llu\n", 1642 "btrfsic: read_block() with unaligned bytenr %llu\n",
1643 block_ctx->dev_bytenr); 1643 block_ctx->dev_bytenr);
1644 return -1; 1644 return -1;
1645 } 1645 }
1646 1646
1647 num_pages = (block_ctx->len + (u64)PAGE_CACHE_SIZE - 1) >> 1647 num_pages = (block_ctx->len + (u64)PAGE_SIZE - 1) >>
1648 PAGE_CACHE_SHIFT; 1648 PAGE_SHIFT;
1649 block_ctx->mem_to_free = kzalloc((sizeof(*block_ctx->datav) + 1649 block_ctx->mem_to_free = kzalloc((sizeof(*block_ctx->datav) +
1650 sizeof(*block_ctx->pagev)) * 1650 sizeof(*block_ctx->pagev)) *
1651 num_pages, GFP_NOFS); 1651 num_pages, GFP_NOFS);
@@ -1676,8 +1676,8 @@ static int btrfsic_read_block(struct btrfsic_state *state,
1676 1676
1677 for (j = i; j < num_pages; j++) { 1677 for (j = i; j < num_pages; j++) {
1678 ret = bio_add_page(bio, block_ctx->pagev[j], 1678 ret = bio_add_page(bio, block_ctx->pagev[j],
1679 PAGE_CACHE_SIZE, 0); 1679 PAGE_SIZE, 0);
1680 if (PAGE_CACHE_SIZE != ret) 1680 if (PAGE_SIZE != ret)
1681 break; 1681 break;
1682 } 1682 }
1683 if (j == i) { 1683 if (j == i) {
@@ -1693,7 +1693,7 @@ static int btrfsic_read_block(struct btrfsic_state *state,
1693 return -1; 1693 return -1;
1694 } 1694 }
1695 bio_put(bio); 1695 bio_put(bio);
1696 dev_bytenr += (j - i) * PAGE_CACHE_SIZE; 1696 dev_bytenr += (j - i) * PAGE_SIZE;
1697 i = j; 1697 i = j;
1698 } 1698 }
1699 for (i = 0; i < num_pages; i++) { 1699 for (i = 0; i < num_pages; i++) {
@@ -1769,9 +1769,9 @@ static int btrfsic_test_for_metadata(struct btrfsic_state *state,
1769 u32 crc = ~(u32)0; 1769 u32 crc = ~(u32)0;
1770 unsigned int i; 1770 unsigned int i;
1771 1771
1772 if (num_pages * PAGE_CACHE_SIZE < state->metablock_size) 1772 if (num_pages * PAGE_SIZE < state->metablock_size)
1773 return 1; /* not metadata */ 1773 return 1; /* not metadata */
1774 num_pages = state->metablock_size >> PAGE_CACHE_SHIFT; 1774 num_pages = state->metablock_size >> PAGE_SHIFT;
1775 h = (struct btrfs_header *)datav[0]; 1775 h = (struct btrfs_header *)datav[0];
1776 1776
1777 if (memcmp(h->fsid, state->root->fs_info->fsid, BTRFS_UUID_SIZE)) 1777 if (memcmp(h->fsid, state->root->fs_info->fsid, BTRFS_UUID_SIZE))
@@ -1779,8 +1779,8 @@ static int btrfsic_test_for_metadata(struct btrfsic_state *state,
1779 1779
1780 for (i = 0; i < num_pages; i++) { 1780 for (i = 0; i < num_pages; i++) {
1781 u8 *data = i ? datav[i] : (datav[i] + BTRFS_CSUM_SIZE); 1781 u8 *data = i ? datav[i] : (datav[i] + BTRFS_CSUM_SIZE);
1782 size_t sublen = i ? PAGE_CACHE_SIZE : 1782 size_t sublen = i ? PAGE_SIZE :
1783 (PAGE_CACHE_SIZE - BTRFS_CSUM_SIZE); 1783 (PAGE_SIZE - BTRFS_CSUM_SIZE);
1784 1784
1785 crc = btrfs_crc32c(crc, data, sublen); 1785 crc = btrfs_crc32c(crc, data, sublen);
1786 } 1786 }
@@ -1826,14 +1826,14 @@ again:
1826 if (block->is_superblock) { 1826 if (block->is_superblock) {
1827 bytenr = btrfs_super_bytenr((struct btrfs_super_block *) 1827 bytenr = btrfs_super_bytenr((struct btrfs_super_block *)
1828 mapped_datav[0]); 1828 mapped_datav[0]);
1829 if (num_pages * PAGE_CACHE_SIZE < 1829 if (num_pages * PAGE_SIZE <
1830 BTRFS_SUPER_INFO_SIZE) { 1830 BTRFS_SUPER_INFO_SIZE) {
1831 printk(KERN_INFO 1831 printk(KERN_INFO
1832 "btrfsic: cannot work with too short bios!\n"); 1832 "btrfsic: cannot work with too short bios!\n");
1833 return; 1833 return;
1834 } 1834 }
1835 is_metadata = 1; 1835 is_metadata = 1;
1836 BUG_ON(BTRFS_SUPER_INFO_SIZE & (PAGE_CACHE_SIZE - 1)); 1836 BUG_ON(BTRFS_SUPER_INFO_SIZE & (PAGE_SIZE - 1));
1837 processed_len = BTRFS_SUPER_INFO_SIZE; 1837 processed_len = BTRFS_SUPER_INFO_SIZE;
1838 if (state->print_mask & 1838 if (state->print_mask &
1839 BTRFSIC_PRINT_MASK_TREE_BEFORE_SB_WRITE) { 1839 BTRFSIC_PRINT_MASK_TREE_BEFORE_SB_WRITE) {
@@ -1844,7 +1844,7 @@ again:
1844 } 1844 }
1845 if (is_metadata) { 1845 if (is_metadata) {
1846 if (!block->is_superblock) { 1846 if (!block->is_superblock) {
1847 if (num_pages * PAGE_CACHE_SIZE < 1847 if (num_pages * PAGE_SIZE <
1848 state->metablock_size) { 1848 state->metablock_size) {
1849 printk(KERN_INFO 1849 printk(KERN_INFO
1850 "btrfsic: cannot work with too short bios!\n"); 1850 "btrfsic: cannot work with too short bios!\n");
@@ -1880,7 +1880,7 @@ again:
1880 } 1880 }
1881 block->logical_bytenr = bytenr; 1881 block->logical_bytenr = bytenr;
1882 } else { 1882 } else {
1883 if (num_pages * PAGE_CACHE_SIZE < 1883 if (num_pages * PAGE_SIZE <
1884 state->datablock_size) { 1884 state->datablock_size) {
1885 printk(KERN_INFO 1885 printk(KERN_INFO
1886 "btrfsic: cannot work with too short bios!\n"); 1886 "btrfsic: cannot work with too short bios!\n");
@@ -2013,7 +2013,7 @@ again:
2013 block->logical_bytenr = bytenr; 2013 block->logical_bytenr = bytenr;
2014 block->is_metadata = 1; 2014 block->is_metadata = 1;
2015 if (block->is_superblock) { 2015 if (block->is_superblock) {
2016 BUG_ON(PAGE_CACHE_SIZE != 2016 BUG_ON(PAGE_SIZE !=
2017 BTRFS_SUPER_INFO_SIZE); 2017 BTRFS_SUPER_INFO_SIZE);
2018 ret = btrfsic_process_written_superblock( 2018 ret = btrfsic_process_written_superblock(
2019 state, 2019 state,
@@ -2172,8 +2172,8 @@ again:
2172continue_loop: 2172continue_loop:
2173 BUG_ON(!processed_len); 2173 BUG_ON(!processed_len);
2174 dev_bytenr += processed_len; 2174 dev_bytenr += processed_len;
2175 mapped_datav += processed_len >> PAGE_CACHE_SHIFT; 2175 mapped_datav += processed_len >> PAGE_SHIFT;
2176 num_pages -= processed_len >> PAGE_CACHE_SHIFT; 2176 num_pages -= processed_len >> PAGE_SHIFT;
2177 goto again; 2177 goto again;
2178} 2178}
2179 2179
@@ -2954,7 +2954,7 @@ static void __btrfsic_submit_bio(int rw, struct bio *bio)
2954 goto leave; 2954 goto leave;
2955 cur_bytenr = dev_bytenr; 2955 cur_bytenr = dev_bytenr;
2956 for (i = 0; i < bio->bi_vcnt; i++) { 2956 for (i = 0; i < bio->bi_vcnt; i++) {
2957 BUG_ON(bio->bi_io_vec[i].bv_len != PAGE_CACHE_SIZE); 2957 BUG_ON(bio->bi_io_vec[i].bv_len != PAGE_SIZE);
2958 mapped_datav[i] = kmap(bio->bi_io_vec[i].bv_page); 2958 mapped_datav[i] = kmap(bio->bi_io_vec[i].bv_page);
2959 if (!mapped_datav[i]) { 2959 if (!mapped_datav[i]) {
2960 while (i > 0) { 2960 while (i > 0) {
@@ -3037,16 +3037,16 @@ int btrfsic_mount(struct btrfs_root *root,
3037 struct list_head *dev_head = &fs_devices->devices; 3037 struct list_head *dev_head = &fs_devices->devices;
3038 struct btrfs_device *device; 3038 struct btrfs_device *device;
3039 3039
3040 if (root->nodesize & ((u64)PAGE_CACHE_SIZE - 1)) { 3040 if (root->nodesize & ((u64)PAGE_SIZE - 1)) {
3041 printk(KERN_INFO 3041 printk(KERN_INFO
3042 "btrfsic: cannot handle nodesize %d not being a multiple of PAGE_CACHE_SIZE %ld!\n", 3042 "btrfsic: cannot handle nodesize %d not being a multiple of PAGE_SIZE %ld!\n",
3043 root->nodesize, PAGE_CACHE_SIZE); 3043 root->nodesize, PAGE_SIZE);
3044 return -1; 3044 return -1;
3045 } 3045 }
3046 if (root->sectorsize & ((u64)PAGE_CACHE_SIZE - 1)) { 3046 if (root->sectorsize & ((u64)PAGE_SIZE - 1)) {
3047 printk(KERN_INFO 3047 printk(KERN_INFO
3048 "btrfsic: cannot handle sectorsize %d not being a multiple of PAGE_CACHE_SIZE %ld!\n", 3048 "btrfsic: cannot handle sectorsize %d not being a multiple of PAGE_SIZE %ld!\n",
3049 root->sectorsize, PAGE_CACHE_SIZE); 3049 root->sectorsize, PAGE_SIZE);
3050 return -1; 3050 return -1;
3051 } 3051 }
3052 state = kzalloc(sizeof(*state), GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); 3052 state = kzalloc(sizeof(*state), GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT);