diff options
Diffstat (limited to 'fs/ext4/balloc.c')
-rw-r--r-- | fs/ext4/balloc.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 22bc7435d913..d2f37a5516c7 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -97,8 +97,8 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
97 | /* If checksum is bad mark all blocks used to prevent allocation | 97 | /* If checksum is bad mark all blocks used to prevent allocation |
98 | * essentially implementing a per-group read-only flag. */ | 98 | * essentially implementing a per-group read-only flag. */ |
99 | if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { | 99 | if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { |
100 | ext4_error(sb, __func__, | 100 | ext4_error(sb, "Checksum bad for group %u", |
101 | "Checksum bad for group %u", block_group); | 101 | block_group); |
102 | ext4_free_blks_set(sb, gdp, 0); | 102 | ext4_free_blks_set(sb, gdp, 0); |
103 | ext4_free_inodes_set(sb, gdp, 0); | 103 | ext4_free_inodes_set(sb, gdp, 0); |
104 | ext4_itable_unused_set(sb, gdp, 0); | 104 | ext4_itable_unused_set(sb, gdp, 0); |
@@ -130,8 +130,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
130 | * to make sure we calculate the right free blocks | 130 | * to make sure we calculate the right free blocks |
131 | */ | 131 | */ |
132 | group_blocks = ext4_blocks_count(sbi->s_es) - | 132 | group_blocks = ext4_blocks_count(sbi->s_es) - |
133 | le32_to_cpu(sbi->s_es->s_first_data_block) - | 133 | ext4_group_first_block_no(sb, ngroups - 1); |
134 | (EXT4_BLOCKS_PER_GROUP(sb) * (ngroups - 1)); | ||
135 | } else { | 134 | } else { |
136 | group_blocks = EXT4_BLOCKS_PER_GROUP(sb); | 135 | group_blocks = EXT4_BLOCKS_PER_GROUP(sb); |
137 | } | 136 | } |
@@ -189,9 +188,6 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
189 | * when a file system is mounted (see ext4_fill_super). | 188 | * when a file system is mounted (see ext4_fill_super). |
190 | */ | 189 | */ |
191 | 190 | ||
192 | |||
193 | #define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1) | ||
194 | |||
195 | /** | 191 | /** |
196 | * ext4_get_group_desc() -- load group descriptor from disk | 192 | * ext4_get_group_desc() -- load group descriptor from disk |
197 | * @sb: super block | 193 | * @sb: super block |
@@ -210,10 +206,8 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb, | |||
210 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 206 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
211 | 207 | ||
212 | if (block_group >= ngroups) { | 208 | if (block_group >= ngroups) { |
213 | ext4_error(sb, "ext4_get_group_desc", | 209 | ext4_error(sb, "block_group >= groups_count - block_group = %u," |
214 | "block_group >= groups_count - " | 210 | " groups_count = %u", block_group, ngroups); |
215 | "block_group = %u, groups_count = %u", | ||
216 | block_group, ngroups); | ||
217 | 211 | ||
218 | return NULL; | 212 | return NULL; |
219 | } | 213 | } |
@@ -221,8 +215,7 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb, | |||
221 | group_desc = block_group >> EXT4_DESC_PER_BLOCK_BITS(sb); | 215 | group_desc = block_group >> EXT4_DESC_PER_BLOCK_BITS(sb); |
222 | offset = block_group & (EXT4_DESC_PER_BLOCK(sb) - 1); | 216 | offset = block_group & (EXT4_DESC_PER_BLOCK(sb) - 1); |
223 | if (!sbi->s_group_desc[group_desc]) { | 217 | if (!sbi->s_group_desc[group_desc]) { |
224 | ext4_error(sb, "ext4_get_group_desc", | 218 | ext4_error(sb, "Group descriptor not loaded - " |
225 | "Group descriptor not loaded - " | ||
226 | "block_group = %u, group_desc = %u, desc = %u", | 219 | "block_group = %u, group_desc = %u, desc = %u", |
227 | block_group, group_desc, offset); | 220 | block_group, group_desc, offset); |
228 | return NULL; | 221 | return NULL; |
@@ -282,9 +275,7 @@ static int ext4_valid_block_bitmap(struct super_block *sb, | |||
282 | return 1; | 275 | return 1; |
283 | 276 | ||
284 | err_out: | 277 | err_out: |
285 | ext4_error(sb, __func__, | 278 | ext4_error(sb, "Invalid block bitmap - block_group = %d, block = %llu", |
286 | "Invalid block bitmap - " | ||
287 | "block_group = %d, block = %llu", | ||
288 | block_group, bitmap_blk); | 279 | block_group, bitmap_blk); |
289 | return 0; | 280 | return 0; |
290 | } | 281 | } |
@@ -311,8 +302,7 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group) | |||
311 | bitmap_blk = ext4_block_bitmap(sb, desc); | 302 | bitmap_blk = ext4_block_bitmap(sb, desc); |
312 | bh = sb_getblk(sb, bitmap_blk); | 303 | bh = sb_getblk(sb, bitmap_blk); |
313 | if (unlikely(!bh)) { | 304 | if (unlikely(!bh)) { |
314 | ext4_error(sb, __func__, | 305 | ext4_error(sb, "Cannot read block bitmap - " |
315 | "Cannot read block bitmap - " | ||
316 | "block_group = %u, block_bitmap = %llu", | 306 | "block_group = %u, block_bitmap = %llu", |
317 | block_group, bitmap_blk); | 307 | block_group, bitmap_blk); |
318 | return NULL; | 308 | return NULL; |
@@ -354,8 +344,7 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group) | |||
354 | set_bitmap_uptodate(bh); | 344 | set_bitmap_uptodate(bh); |
355 | if (bh_submit_read(bh) < 0) { | 345 | if (bh_submit_read(bh) < 0) { |
356 | put_bh(bh); | 346 | put_bh(bh); |
357 | ext4_error(sb, __func__, | 347 | ext4_error(sb, "Cannot read block bitmap - " |
358 | "Cannot read block bitmap - " | ||
359 | "block_group = %u, block_bitmap = %llu", | 348 | "block_group = %u, block_bitmap = %llu", |
360 | block_group, bitmap_blk); | 349 | block_group, bitmap_blk); |
361 | return NULL; | 350 | return NULL; |
@@ -419,8 +408,7 @@ void ext4_add_groupblocks(handle_t *handle, struct super_block *sb, | |||
419 | in_range(block, ext4_inode_table(sb, desc), sbi->s_itb_per_group) || | 408 | in_range(block, ext4_inode_table(sb, desc), sbi->s_itb_per_group) || |
420 | in_range(block + count - 1, ext4_inode_table(sb, desc), | 409 | in_range(block + count - 1, ext4_inode_table(sb, desc), |
421 | sbi->s_itb_per_group)) { | 410 | sbi->s_itb_per_group)) { |
422 | ext4_error(sb, __func__, | 411 | ext4_error(sb, "Adding blocks in system zones - " |
423 | "Adding blocks in system zones - " | ||
424 | "Block = %llu, count = %lu", | 412 | "Block = %llu, count = %lu", |
425 | block, count); | 413 | block, count); |
426 | goto error_return; | 414 | goto error_return; |
@@ -453,8 +441,7 @@ void ext4_add_groupblocks(handle_t *handle, struct super_block *sb, | |||
453 | BUFFER_TRACE(bitmap_bh, "clear bit"); | 441 | BUFFER_TRACE(bitmap_bh, "clear bit"); |
454 | if (!ext4_clear_bit_atomic(ext4_group_lock_ptr(sb, block_group), | 442 | if (!ext4_clear_bit_atomic(ext4_group_lock_ptr(sb, block_group), |
455 | bit + i, bitmap_bh->b_data)) { | 443 | bit + i, bitmap_bh->b_data)) { |
456 | ext4_error(sb, __func__, | 444 | ext4_error(sb, "bit already cleared for block %llu", |
457 | "bit already cleared for block %llu", | ||
458 | (ext4_fsblk_t)(block + i)); | 445 | (ext4_fsblk_t)(block + i)); |
459 | BUFFER_TRACE(bitmap_bh, "bit already cleared"); | 446 | BUFFER_TRACE(bitmap_bh, "bit already cleared"); |
460 | } else { | 447 | } else { |