diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/balloc.c | 20 | ||||
-rw-r--r-- | fs/ext4/ialloc.c | 4 | ||||
-rw-r--r-- | fs/ext4/inode.c | 7 | ||||
-rw-r--r-- | fs/ext4/resize.c | 6 | ||||
-rw-r--r-- | fs/ext4/super.c | 46 |
5 files changed, 47 insertions, 36 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 3dacb124b8c8..3e85886a6382 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -101,13 +101,13 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) | |||
101 | desc = ext4_get_group_desc (sb, block_group, NULL); | 101 | desc = ext4_get_group_desc (sb, block_group, NULL); |
102 | if (!desc) | 102 | if (!desc) |
103 | goto error_out; | 103 | goto error_out; |
104 | bh = sb_bread(sb, ext4_block_bitmap(desc)); | 104 | bh = sb_bread(sb, ext4_block_bitmap(sb, desc)); |
105 | if (!bh) | 105 | if (!bh) |
106 | ext4_error (sb, "read_block_bitmap", | 106 | ext4_error (sb, "read_block_bitmap", |
107 | "Cannot read block bitmap - " | 107 | "Cannot read block bitmap - " |
108 | "block_group = %d, block_bitmap = %llu", | 108 | "block_group = %d, block_bitmap = %llu", |
109 | block_group, | 109 | block_group, |
110 | ext4_block_bitmap(desc)); | 110 | ext4_block_bitmap(sb, desc)); |
111 | error_out: | 111 | error_out: |
112 | return bh; | 112 | return bh; |
113 | } | 113 | } |
@@ -463,10 +463,10 @@ do_more: | |||
463 | if (!desc) | 463 | if (!desc) |
464 | goto error_return; | 464 | goto error_return; |
465 | 465 | ||
466 | if (in_range(ext4_block_bitmap(desc), block, count) || | 466 | if (in_range(ext4_block_bitmap(sb, desc), block, count) || |
467 | in_range(ext4_inode_bitmap(desc), block, count) || | 467 | in_range(ext4_inode_bitmap(sb, desc), block, count) || |
468 | in_range(block, ext4_inode_table(desc), sbi->s_itb_per_group) || | 468 | in_range(block, ext4_inode_table(sb, desc), sbi->s_itb_per_group) || |
469 | in_range(block + count - 1, ext4_inode_table(desc), | 469 | in_range(block + count - 1, ext4_inode_table(sb, desc), |
470 | sbi->s_itb_per_group)) | 470 | sbi->s_itb_per_group)) |
471 | ext4_error (sb, "ext4_free_blocks", | 471 | ext4_error (sb, "ext4_free_blocks", |
472 | "Freeing blocks in system zones - " | 472 | "Freeing blocks in system zones - " |
@@ -1563,11 +1563,11 @@ allocated: | |||
1563 | 1563 | ||
1564 | ret_block = grp_alloc_blk + ext4_group_first_block_no(sb, group_no); | 1564 | ret_block = grp_alloc_blk + ext4_group_first_block_no(sb, group_no); |
1565 | 1565 | ||
1566 | if (in_range(ext4_block_bitmap(gdp), ret_block, num) || | 1566 | if (in_range(ext4_block_bitmap(sb, gdp), ret_block, num) || |
1567 | in_range(ext4_block_bitmap(gdp), ret_block, num) || | 1567 | in_range(ext4_block_bitmap(sb, gdp), ret_block, num) || |
1568 | in_range(ret_block, ext4_inode_table(gdp), | 1568 | in_range(ret_block, ext4_inode_table(sb, gdp), |
1569 | EXT4_SB(sb)->s_itb_per_group) || | 1569 | EXT4_SB(sb)->s_itb_per_group) || |
1570 | in_range(ret_block + num - 1, ext4_inode_table(gdp), | 1570 | in_range(ret_block + num - 1, ext4_inode_table(sb, gdp), |
1571 | EXT4_SB(sb)->s_itb_per_group)) | 1571 | EXT4_SB(sb)->s_itb_per_group)) |
1572 | ext4_error(sb, "ext4_new_block", | 1572 | ext4_error(sb, "ext4_new_block", |
1573 | "Allocating block in system zone - " | 1573 | "Allocating block in system zone - " |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 959b7fa8f5db..75608e1e5555 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -60,12 +60,12 @@ read_inode_bitmap(struct super_block * sb, unsigned long block_group) | |||
60 | if (!desc) | 60 | if (!desc) |
61 | goto error_out; | 61 | goto error_out; |
62 | 62 | ||
63 | bh = sb_bread(sb, ext4_inode_bitmap(desc)); | 63 | bh = sb_bread(sb, ext4_inode_bitmap(sb, desc)); |
64 | if (!bh) | 64 | if (!bh) |
65 | ext4_error(sb, "read_inode_bitmap", | 65 | ext4_error(sb, "read_inode_bitmap", |
66 | "Cannot read inode bitmap - " | 66 | "Cannot read inode bitmap - " |
67 | "block_group = %lu, inode_bitmap = %llu", | 67 | "block_group = %lu, inode_bitmap = %llu", |
68 | block_group, ext4_inode_bitmap(desc)); | 68 | block_group, ext4_inode_bitmap(sb, desc)); |
69 | error_out: | 69 | error_out: |
70 | return bh; | 70 | return bh; |
71 | } | 71 | } |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d03e7d85a638..0a60ec5a16db 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2439,9 +2439,8 @@ static ext4_fsblk_t ext4_get_inode_block(struct super_block *sb, | |||
2439 | */ | 2439 | */ |
2440 | offset = ((ino - 1) % EXT4_INODES_PER_GROUP(sb)) * | 2440 | offset = ((ino - 1) % EXT4_INODES_PER_GROUP(sb)) * |
2441 | EXT4_INODE_SIZE(sb); | 2441 | EXT4_INODE_SIZE(sb); |
2442 | block = ext4_inode_table(gdp) + (offset >> EXT4_BLOCK_SIZE_BITS(sb)); | 2442 | block = ext4_inode_table(sb, gdp) + |
2443 | 2443 | (offset >> EXT4_BLOCK_SIZE_BITS(sb)); | |
2444 | |||
2445 | 2444 | ||
2446 | iloc->block_group = block_group; | 2445 | iloc->block_group = block_group; |
2447 | iloc->offset = offset & (EXT4_BLOCK_SIZE(sb) - 1); | 2446 | iloc->offset = offset & (EXT4_BLOCK_SIZE(sb) - 1); |
@@ -2508,7 +2507,7 @@ static int __ext4_get_inode_loc(struct inode *inode, | |||
2508 | goto make_io; | 2507 | goto make_io; |
2509 | 2508 | ||
2510 | bitmap_bh = sb_getblk(inode->i_sb, | 2509 | bitmap_bh = sb_getblk(inode->i_sb, |
2511 | ext4_inode_bitmap(desc)); | 2510 | ext4_inode_bitmap(inode->i_sb, desc)); |
2512 | if (!bitmap_bh) | 2511 | if (!bitmap_bh) |
2513 | goto make_io; | 2512 | goto make_io; |
2514 | 2513 | ||
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 3e960677c2f2..1e9578052cd3 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -834,9 +834,9 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) | |||
834 | /* Update group descriptor block for new group */ | 834 | /* Update group descriptor block for new group */ |
835 | gdp = (struct ext4_group_desc *)primary->b_data + gdb_off; | 835 | gdp = (struct ext4_group_desc *)primary->b_data + gdb_off; |
836 | 836 | ||
837 | ext4_block_bitmap_set(gdp, input->block_bitmap); /* LV FIXME */ | 837 | ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */ |
838 | ext4_inode_bitmap_set(gdp, input->inode_bitmap); /* LV FIXME */ | 838 | ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */ |
839 | ext4_inode_table_set(gdp, input->inode_table); /* LV FIXME */ | 839 | ext4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */ |
840 | gdp->bg_free_blocks_count = cpu_to_le16(input->free_blocks_count); | 840 | gdp->bg_free_blocks_count = cpu_to_le16(input->free_blocks_count); |
841 | gdp->bg_free_inodes_count = cpu_to_le16(EXT4_INODES_PER_GROUP(sb)); | 841 | gdp->bg_free_inodes_count = cpu_to_le16(EXT4_INODES_PER_GROUP(sb)); |
842 | 842 | ||
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index bc8848bff2f1..811011fc5c94 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -63,40 +63,52 @@ static void ext4_write_super (struct super_block * sb); | |||
63 | static void ext4_write_super_lockfs(struct super_block *sb); | 63 | static void ext4_write_super_lockfs(struct super_block *sb); |
64 | 64 | ||
65 | 65 | ||
66 | ext4_fsblk_t ext4_block_bitmap(struct ext4_group_desc *bg) | 66 | ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, |
67 | struct ext4_group_desc *bg) | ||
67 | { | 68 | { |
68 | return le32_to_cpu(bg->bg_block_bitmap) | | 69 | return le32_to_cpu(bg->bg_block_bitmap) | |
69 | ((ext4_fsblk_t)le16_to_cpu(bg->bg_block_bitmap_hi) << 32); | 70 | (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? |
71 | (ext4_fsblk_t)le32_to_cpu(bg->bg_block_bitmap_hi) << 32 : 0); | ||
70 | } | 72 | } |
71 | 73 | ||
72 | ext4_fsblk_t ext4_inode_bitmap(struct ext4_group_desc *bg) | 74 | ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, |
75 | struct ext4_group_desc *bg) | ||
73 | { | 76 | { |
74 | return le32_to_cpu(bg->bg_inode_bitmap) | | 77 | return le32_to_cpu(bg->bg_inode_bitmap) | |
75 | ((ext4_fsblk_t)le16_to_cpu(bg->bg_inode_bitmap_hi) << 32); | 78 | (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? |
79 | (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_bitmap_hi) << 32 : 0); | ||
76 | } | 80 | } |
77 | 81 | ||
78 | ext4_fsblk_t ext4_inode_table(struct ext4_group_desc *bg) | 82 | ext4_fsblk_t ext4_inode_table(struct super_block *sb, |
83 | struct ext4_group_desc *bg) | ||
79 | { | 84 | { |
80 | return le32_to_cpu(bg->bg_inode_table) | | 85 | return le32_to_cpu(bg->bg_inode_table) | |
81 | ((ext4_fsblk_t)le16_to_cpu(bg->bg_inode_table_hi) << 32); | 86 | (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? |
87 | (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_table_hi) << 32 : 0); | ||
82 | } | 88 | } |
83 | 89 | ||
84 | void ext4_block_bitmap_set(struct ext4_group_desc *bg, ext4_fsblk_t blk) | 90 | void ext4_block_bitmap_set(struct super_block *sb, |
91 | struct ext4_group_desc *bg, ext4_fsblk_t blk) | ||
85 | { | 92 | { |
86 | bg->bg_block_bitmap = cpu_to_le32((u32)blk); | 93 | bg->bg_block_bitmap = cpu_to_le32((u32)blk); |
87 | bg->bg_block_bitmap_hi = cpu_to_le16(blk >> 32); | 94 | if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) |
95 | bg->bg_block_bitmap_hi = cpu_to_le32(blk >> 32); | ||
88 | } | 96 | } |
89 | 97 | ||
90 | void ext4_inode_bitmap_set(struct ext4_group_desc *bg, ext4_fsblk_t blk) | 98 | void ext4_inode_bitmap_set(struct super_block *sb, |
99 | struct ext4_group_desc *bg, ext4_fsblk_t blk) | ||
91 | { | 100 | { |
92 | bg->bg_inode_bitmap = cpu_to_le32((u32)blk); | 101 | bg->bg_inode_bitmap = cpu_to_le32((u32)blk); |
93 | bg->bg_inode_bitmap_hi = cpu_to_le16(blk >> 32); | 102 | if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) |
103 | bg->bg_inode_bitmap_hi = cpu_to_le32(blk >> 32); | ||
94 | } | 104 | } |
95 | 105 | ||
96 | void ext4_inode_table_set(struct ext4_group_desc *bg, ext4_fsblk_t blk) | 106 | void ext4_inode_table_set(struct super_block *sb, |
107 | struct ext4_group_desc *bg, ext4_fsblk_t blk) | ||
97 | { | 108 | { |
98 | bg->bg_inode_table = cpu_to_le32((u32)blk); | 109 | bg->bg_inode_table = cpu_to_le32((u32)blk); |
99 | bg->bg_inode_table_hi = cpu_to_le16(blk >> 32); | 110 | if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) |
111 | bg->bg_inode_table_hi = cpu_to_le32(blk >> 32); | ||
100 | } | 112 | } |
101 | 113 | ||
102 | /* | 114 | /* |
@@ -1239,7 +1251,7 @@ static int ext4_check_descriptors (struct super_block * sb) | |||
1239 | if ((i % EXT4_DESC_PER_BLOCK(sb)) == 0) | 1251 | if ((i % EXT4_DESC_PER_BLOCK(sb)) == 0) |
1240 | gdp = (struct ext4_group_desc *) | 1252 | gdp = (struct ext4_group_desc *) |
1241 | sbi->s_group_desc[desc_block++]->b_data; | 1253 | sbi->s_group_desc[desc_block++]->b_data; |
1242 | block_bitmap = ext4_block_bitmap(gdp); | 1254 | block_bitmap = ext4_block_bitmap(sb, gdp); |
1243 | if (block_bitmap < first_block || block_bitmap > last_block) | 1255 | if (block_bitmap < first_block || block_bitmap > last_block) |
1244 | { | 1256 | { |
1245 | ext4_error (sb, "ext4_check_descriptors", | 1257 | ext4_error (sb, "ext4_check_descriptors", |
@@ -1248,7 +1260,7 @@ static int ext4_check_descriptors (struct super_block * sb) | |||
1248 | i, block_bitmap); | 1260 | i, block_bitmap); |
1249 | return 0; | 1261 | return 0; |
1250 | } | 1262 | } |
1251 | inode_bitmap = ext4_inode_bitmap(gdp); | 1263 | inode_bitmap = ext4_inode_bitmap(sb, gdp); |
1252 | if (inode_bitmap < first_block || inode_bitmap > last_block) | 1264 | if (inode_bitmap < first_block || inode_bitmap > last_block) |
1253 | { | 1265 | { |
1254 | ext4_error (sb, "ext4_check_descriptors", | 1266 | ext4_error (sb, "ext4_check_descriptors", |
@@ -1257,7 +1269,7 @@ static int ext4_check_descriptors (struct super_block * sb) | |||
1257 | i, inode_bitmap); | 1269 | i, inode_bitmap); |
1258 | return 0; | 1270 | return 0; |
1259 | } | 1271 | } |
1260 | inode_table = ext4_inode_table(gdp); | 1272 | inode_table = ext4_inode_table(sb, gdp); |
1261 | if (inode_table < first_block || | 1273 | if (inode_table < first_block || |
1262 | inode_table + sbi->s_itb_per_group > last_block) | 1274 | inode_table + sbi->s_itb_per_group > last_block) |
1263 | { | 1275 | { |
@@ -1622,11 +1634,11 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) | |||
1622 | } | 1634 | } |
1623 | sbi->s_desc_size = le16_to_cpu(es->s_desc_size); | 1635 | sbi->s_desc_size = le16_to_cpu(es->s_desc_size); |
1624 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) { | 1636 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) { |
1625 | if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE || | 1637 | if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT || |
1626 | sbi->s_desc_size > EXT4_MAX_DESC_SIZE || | 1638 | sbi->s_desc_size > EXT4_MAX_DESC_SIZE || |
1627 | sbi->s_desc_size & (sbi->s_desc_size - 1)) { | 1639 | sbi->s_desc_size & (sbi->s_desc_size - 1)) { |
1628 | printk(KERN_ERR | 1640 | printk(KERN_ERR |
1629 | "EXT4-fs: unsupported descriptor size %ld\n", | 1641 | "EXT4-fs: unsupported descriptor size %lu\n", |
1630 | sbi->s_desc_size); | 1642 | sbi->s_desc_size); |
1631 | goto failed_mount; | 1643 | goto failed_mount; |
1632 | } | 1644 | } |