We're using macro EXT4_B2C() to convert number of blocks to number of clusters for bigalloc file systems. However, we should be using EXT4_NUM_B2C().
Unified · Split
| @@ -635,7 +635,7 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb) · 634 unmodified lines | ||
| 635 | 635 | brelse(bitmap_bh); |
| 636 | 636 | printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu" |
| 637 | 637 | ", computed = %llu, %llu\n", |
| 638 | − EXT4_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)), | |
| 638 | + EXT4_NUM_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)), | |
| 639 | 639 | desc_count, bitmap_count); |
| 640 | 640 | return bitmap_count; |
| 641 | 641 | #else |
| @@ -3419,7 +3419,7 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) · 3418 unmodified lines | ||
| 3419 | 3419 | win = offs; |
| 3420 | 3420 | |
| 3421 | 3421 | ac->ac_b_ex.fe_logical = ac->ac_o_ex.fe_logical - |
| 3422 | − EXT4_B2C(sbi, win); | |
| 3422 | + EXT4_NUM_B2C(sbi, win); | |
| 3423 | 3423 | BUG_ON(ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical); |
| 3424 | 3424 | BUG_ON(ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len); |
| 3425 | 3425 | } |
| @@ -4565,7 +4565,7 @@ do_more: · 1139 unmodified lines | ||
| 4565 | 4565 | EXT4_BLOCKS_PER_GROUP(sb); |
| 4566 | 4566 | count -= overflow; |
| 4567 | 4567 | } |
| 4568 | − count_clusters = EXT4_B2C(sbi, count); | |
| 4568 | + count_clusters = EXT4_NUM_B2C(sbi, count); | |
| 4569 | 4569 | bitmap_bh = ext4_read_block_bitmap(sb, block_group); |
| 4570 | 4570 | if (!bitmap_bh) { |
| 4571 | 4571 | err = -EIO; |
| @@ -4807,11 +4807,11 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, · 235 unmodified lines | ||
| 4807 | 4807 | ext4_group_desc_csum_set(sb, block_group, desc); |
| 4808 | 4808 | ext4_unlock_group(sb, block_group); |
| 4809 | 4809 | percpu_counter_add(&sbi->s_freeclusters_counter, |
| 4810 | − EXT4_B2C(sbi, blocks_freed)); | |
| 4810 | + EXT4_NUM_B2C(sbi, blocks_freed)); | |
| 4811 | 4811 | |
| 4812 | 4812 | if (sbi->s_log_groups_per_flex) { |
| 4813 | 4813 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); |
| 4814 | − atomic_add(EXT4_B2C(sbi, blocks_freed), | |
| 4814 | + atomic_add(EXT4_NUM_B2C(sbi, blocks_freed), | |
| 4815 | 4815 | &sbi->s_flex_groups[flex_group].free_clusters); |
| 4816 | 4816 | } |
| 4817 | 4817 | |
| @@ -1247,7 +1247,7 @@ static int ext4_setup_new_descs(handle_t *handle, struct super_block *sb, · 1246 unmodified lines | ||
| 1247 | 1247 | |
| 1248 | 1248 | ext4_inode_table_set(sb, gdp, group_data->inode_table); |
| 1249 | 1249 | ext4_free_group_clusters_set(sb, gdp, |
| 1250 | − EXT4_B2C(sbi, group_data->free_blocks_count)); | |
| 1250 | + EXT4_NUM_B2C(sbi, group_data->free_blocks_count)); | |
| 1251 | 1251 | ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb)); |
| 1252 | 1252 | if (ext4_has_group_desc_csum(sb)) |
| 1253 | 1253 | ext4_itable_unused_set(sb, gdp, |
| @@ -1349,7 +1349,7 @@ static void ext4_update_super(struct super_block *sb, · 95 unmodified lines | ||
| 1349 | 1349 | |
| 1350 | 1350 | /* Update the free space counts */ |
| 1351 | 1351 | percpu_counter_add(&sbi->s_freeclusters_counter, |
| 1352 | − EXT4_B2C(sbi, free_blocks)); | |
| 1352 | + EXT4_NUM_B2C(sbi, free_blocks)); | |
| 1353 | 1353 | percpu_counter_add(&sbi->s_freeinodes_counter, |
| 1354 | 1354 | EXT4_INODES_PER_GROUP(sb) * flex_gd->count); |
| 1355 | 1355 | |
| @@ -1360,7 +1360,7 @@ static void ext4_update_super(struct super_block *sb, · 4 unmodified lines | ||
| 1360 | 1360 | sbi->s_log_groups_per_flex) { |
| 1361 | 1361 | ext4_group_t flex_group; |
| 1362 | 1362 | flex_group = ext4_flex_group(sbi, group_data[0].group); |
| 1363 | − atomic_add(EXT4_B2C(sbi, free_blocks), | |
| 1363 | + atomic_add(EXT4_NUM_B2C(sbi, free_blocks), | |
| 1364 | 1364 | &sbi->s_flex_groups[flex_group].free_clusters); |
| 1365 | 1365 | atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count, |
| 1366 | 1366 | &sbi->s_flex_groups[flex_group].free_inodes); |
| @@ -3162,7 +3162,7 @@ int ext4_calculate_overhead(struct super_block *sb) · 3161 unmodified lines | ||
| 3162 | 3162 | } |
| 3163 | 3163 | /* Add the journal blocks as well */ |
| 3164 | 3164 | if (sbi->s_journal) |
| 3165 | − overhead += EXT4_B2C(sbi, sbi->s_journal->j_maxlen); | |
| 3165 | + overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_maxlen); | |
| 3166 | 3166 | |
| 3167 | 3167 | sbi->s_overhead = overhead; |
| 3168 | 3168 | smp_wmb(); |