aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2013-03-02 17:18:58 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-03-02 17:18:58 -0500
commit810da240f221d64bf90020f25941b05b378186fe (patch)
tree9fb624e43c624bf8e38077804ca2f95026c11b53 /fs
parent3e36a16375eee390a9d80f99499fe630efa08128 (diff)
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(). Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: stable@vger.kernel.org
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/balloc.c2
-rw-r--r--fs/ext4/mballoc.c8
-rw-r--r--fs/ext4/resize.c6
-rw-r--r--fs/ext4/super.c2
4 files changed, 9 insertions, 9 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 2f2e0da1a6b7..92e68b33fffd 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -635,7 +635,7 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb)
635 brelse(bitmap_bh); 635 brelse(bitmap_bh);
636 printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu" 636 printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu"
637 ", computed = %llu, %llu\n", 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 desc_count, bitmap_count); 639 desc_count, bitmap_count);
640 return bitmap_count; 640 return bitmap_count;
641#else 641#else
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 6540ebe058e3..7bb713a46fe4 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3419,7 +3419,7 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
3419 win = offs; 3419 win = offs;
3420 3420
3421 ac->ac_b_ex.fe_logical = ac->ac_o_ex.fe_logical - 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 BUG_ON(ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical); 3423 BUG_ON(ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical);
3424 BUG_ON(ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len); 3424 BUG_ON(ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len);
3425 } 3425 }
@@ -4565,7 +4565,7 @@ do_more:
4565 EXT4_BLOCKS_PER_GROUP(sb); 4565 EXT4_BLOCKS_PER_GROUP(sb);
4566 count -= overflow; 4566 count -= overflow;
4567 } 4567 }
4568 count_clusters = EXT4_B2C(sbi, count); 4568 count_clusters = EXT4_NUM_B2C(sbi, count);
4569 bitmap_bh = ext4_read_block_bitmap(sb, block_group); 4569 bitmap_bh = ext4_read_block_bitmap(sb, block_group);
4570 if (!bitmap_bh) { 4570 if (!bitmap_bh) {
4571 err = -EIO; 4571 err = -EIO;
@@ -4807,11 +4807,11 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
4807 ext4_group_desc_csum_set(sb, block_group, desc); 4807 ext4_group_desc_csum_set(sb, block_group, desc);
4808 ext4_unlock_group(sb, block_group); 4808 ext4_unlock_group(sb, block_group);
4809 percpu_counter_add(&sbi->s_freeclusters_counter, 4809 percpu_counter_add(&sbi->s_freeclusters_counter,
4810 EXT4_B2C(sbi, blocks_freed)); 4810 EXT4_NUM_B2C(sbi, blocks_freed));
4811 4811
4812 if (sbi->s_log_groups_per_flex) { 4812 if (sbi->s_log_groups_per_flex) {
4813 ext4_group_t flex_group = ext4_flex_group(sbi, block_group); 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 &sbi->s_flex_groups[flex_group].free_clusters); 4815 &sbi->s_flex_groups[flex_group].free_clusters);
4816 } 4816 }
4817 4817
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index c7f4d7584669..b2c8ee56eb98 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1247,7 +1247,7 @@ static int ext4_setup_new_descs(handle_t *handle, struct super_block *sb,
1247 1247
1248 ext4_inode_table_set(sb, gdp, group_data->inode_table); 1248 ext4_inode_table_set(sb, gdp, group_data->inode_table);
1249 ext4_free_group_clusters_set(sb, gdp, 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 ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb)); 1251 ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb));
1252 if (ext4_has_group_desc_csum(sb)) 1252 if (ext4_has_group_desc_csum(sb))
1253 ext4_itable_unused_set(sb, gdp, 1253 ext4_itable_unused_set(sb, gdp,
@@ -1349,7 +1349,7 @@ static void ext4_update_super(struct super_block *sb,
1349 1349
1350 /* Update the free space counts */ 1350 /* Update the free space counts */
1351 percpu_counter_add(&sbi->s_freeclusters_counter, 1351 percpu_counter_add(&sbi->s_freeclusters_counter,
1352 EXT4_B2C(sbi, free_blocks)); 1352 EXT4_NUM_B2C(sbi, free_blocks));
1353 percpu_counter_add(&sbi->s_freeinodes_counter, 1353 percpu_counter_add(&sbi->s_freeinodes_counter,
1354 EXT4_INODES_PER_GROUP(sb) * flex_gd->count); 1354 EXT4_INODES_PER_GROUP(sb) * flex_gd->count);
1355 1355
@@ -1360,7 +1360,7 @@ static void ext4_update_super(struct super_block *sb,
1360 sbi->s_log_groups_per_flex) { 1360 sbi->s_log_groups_per_flex) {
1361 ext4_group_t flex_group; 1361 ext4_group_t flex_group;
1362 flex_group = ext4_flex_group(sbi, group_data[0].group); 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 &sbi->s_flex_groups[flex_group].free_clusters); 1364 &sbi->s_flex_groups[flex_group].free_clusters);
1365 atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count, 1365 atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count,
1366 &sbi->s_flex_groups[flex_group].free_inodes); 1366 &sbi->s_flex_groups[flex_group].free_inodes);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6ac9c8a3eb08..990ceab2e2bc 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3162,7 +3162,7 @@ int ext4_calculate_overhead(struct super_block *sb)
3162 } 3162 }
3163 /* Add the journal blocks as well */ 3163 /* Add the journal blocks as well */
3164 if (sbi->s_journal) 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 sbi->s_overhead = overhead; 3167 sbi->s_overhead = overhead;
3168 smp_wmb(); 3168 smp_wmb();