History

ext4: convert number of blocks to clusters properly

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().

Lukas Czerner committed 13 years ago

Commit 810da241 parent 3e36a164 files · +9 −9Browse files

Unified · Split

4 files
  1. fs/ext4/balloc.c +1 −1
  2. fs/ext4/mballoc.c +4 −4
  3. fs/ext4/resize.c +3 −3
  4. fs/ext4/super.c +1 −1
fs/ext4/balloc.c+1−1
@@ -635,7 +635,7 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb) · 634 unmodified lines
635635 brelse(bitmap_bh);
636636 printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu"
637637 ", 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)),
639639 desc_count, bitmap_count);
640640 return bitmap_count;
641641 #else
fs/ext4/mballoc.c+4−4
@@ -3419,7 +3419,7 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) · 3418 unmodified lines
34193419 win = offs;
34203420
34213421 ac->ac_b_ex.fe_logical = ac->ac_o_ex.fe_logical -
3422− EXT4_B2C(sbi, win);
3422+ EXT4_NUM_B2C(sbi, win);
34233423 BUG_ON(ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical);
34243424 BUG_ON(ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len);
34253425 }
@@ -4565,7 +4565,7 @@ do_more: · 1139 unmodified lines
45654565 EXT4_BLOCKS_PER_GROUP(sb);
45664566 count -= overflow;
45674567 }
4568− count_clusters = EXT4_B2C(sbi, count);
4568+ count_clusters = EXT4_NUM_B2C(sbi, count);
45694569 bitmap_bh = ext4_read_block_bitmap(sb, block_group);
45704570 if (!bitmap_bh) {
45714571 err = -EIO;
@@ -4807,11 +4807,11 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, · 235 unmodified lines
48074807 ext4_group_desc_csum_set(sb, block_group, desc);
48084808 ext4_unlock_group(sb, block_group);
48094809 percpu_counter_add(&sbi->s_freeclusters_counter,
4810− EXT4_B2C(sbi, blocks_freed));
4810+ EXT4_NUM_B2C(sbi, blocks_freed));
48114811
48124812 if (sbi->s_log_groups_per_flex) {
48134813 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),
48154815 &sbi->s_flex_groups[flex_group].free_clusters);
48164816 }
48174817
fs/ext4/resize.c+3−3
@@ -1247,7 +1247,7 @@ static int ext4_setup_new_descs(handle_t *handle, struct super_block *sb, · 1246 unmodified lines
12471247
12481248 ext4_inode_table_set(sb, gdp, group_data->inode_table);
12491249 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));
12511251 ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb));
12521252 if (ext4_has_group_desc_csum(sb))
12531253 ext4_itable_unused_set(sb, gdp,
@@ -1349,7 +1349,7 @@ static void ext4_update_super(struct super_block *sb, · 95 unmodified lines
13491349
13501350 /* Update the free space counts */
13511351 percpu_counter_add(&sbi->s_freeclusters_counter,
1352− EXT4_B2C(sbi, free_blocks));
1352+ EXT4_NUM_B2C(sbi, free_blocks));
13531353 percpu_counter_add(&sbi->s_freeinodes_counter,
13541354 EXT4_INODES_PER_GROUP(sb) * flex_gd->count);
13551355
@@ -1360,7 +1360,7 @@ static void ext4_update_super(struct super_block *sb, · 4 unmodified lines
13601360 sbi->s_log_groups_per_flex) {
13611361 ext4_group_t flex_group;
13621362 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),
13641364 &sbi->s_flex_groups[flex_group].free_clusters);
13651365 atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count,
13661366 &sbi->s_flex_groups[flex_group].free_inodes);
fs/ext4/super.c+1−1
@@ -3162,7 +3162,7 @@ int ext4_calculate_overhead(struct super_block *sb) · 3161 unmodified lines
31623162 }
31633163 /* Add the journal blocks as well */
31643164 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);
31663166
31673167 sbi->s_overhead = overhead;
31683168 smp_wmb();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t